Skip to content

Commit 4f598b8

Browse files
committed
Add comments to WorkItemResult.
And rename the `Compiled` variant as `Finished`, because that name makes it clearer there is nothing left to do, contrasting nicely with the `Needs*` variants.
1 parent a8c71f0 commit 4f598b8

File tree

1 file changed

+14
-4
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+14
-4
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,19 @@ impl<B: WriteBackendMethods> WorkItem<B> {
751751

752752
/// A result produced by the backend.
753753
pub(crate) enum WorkItemResult<B: WriteBackendMethods> {
754-
Compiled(CompiledModule),
754+
/// The backend has finished compiling a CGU, nothing more required.
755+
Finished(CompiledModule),
756+
757+
/// The backend has finished compiling a CGU, which now needs linking
758+
/// because `-Zcombine-cgu` was specified.
755759
NeedsLink(ModuleCodegen<B::Module>),
760+
761+
/// The backend has finished compiling a CGU, which now needs to go through
762+
/// fat LTO.
756763
NeedsFatLTO(FatLTOInput<B>),
764+
765+
/// The backend has finished compiling a CGU, which now needs to go through
766+
/// thin LTO.
757767
NeedsThinLTO(String, B::ThinBuffer),
758768
}
759769

@@ -906,7 +916,7 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
906916
load_from_incr_comp_dir(dwarf_obj_out, &saved_dwarf_object_file)
907917
});
908918

909-
WorkItemResult::Compiled(CompiledModule {
919+
WorkItemResult::Finished(CompiledModule {
910920
name: module.name,
911921
kind: ModuleKind::Regular,
912922
object,
@@ -936,7 +946,7 @@ fn finish_intra_module_work<B: ExtraBackendMethods>(
936946
|| module.kind == ModuleKind::Allocator
937947
{
938948
let module = unsafe { B::codegen(cgcx, &diag_handler, module, module_config)? };
939-
Ok(WorkItemResult::Compiled(module))
949+
Ok(WorkItemResult::Finished(module))
940950
} else {
941951
Ok(WorkItemResult::NeedsLink(module))
942952
}
@@ -1522,7 +1532,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
15221532
free_worker(worker_id);
15231533

15241534
match result {
1525-
Ok(WorkItemResult::Compiled(compiled_module)) => {
1535+
Ok(WorkItemResult::Finished(compiled_module)) => {
15261536
match compiled_module.kind {
15271537
ModuleKind::Regular => {
15281538
compiled_modules.push(compiled_module);

0 commit comments

Comments
 (0)