From fd017d3c170796790755441dbb95020b13fd5549 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 20 Jul 2023 11:48:11 +1000 Subject: [PATCH] Add some assertions. - Thin and fat LTO can't happen together. - `NeedsLink` and (non-allocator) `Compiled` work item results can't happen together. --- compiler/rustc_codegen_ssa/src/back/write.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index 2ef0a7c1eac..540685bd117 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1535,6 +1535,7 @@ enum CodegenState { Ok(WorkItemResult::Finished(compiled_module)) => { match compiled_module.kind { ModuleKind::Regular => { + assert!(needs_link.is_empty()); compiled_modules.push(compiled_module); } ModuleKind::Allocator => { @@ -1545,14 +1546,17 @@ enum CodegenState { } } Ok(WorkItemResult::NeedsLink(module)) => { + assert!(compiled_modules.is_empty()); needs_link.push(module); } Ok(WorkItemResult::NeedsFatLTO(fat_lto_input)) => { assert!(!started_lto); + assert!(needs_thin_lto.is_empty()); needs_fat_lto.push(fat_lto_input); } Ok(WorkItemResult::NeedsThinLTO(name, thin_buffer)) => { assert!(!started_lto); + assert!(needs_fat_lto.is_empty()); needs_thin_lto.push((name, thin_buffer)); } Err(Some(WorkerFatalError)) => {