Skip to content

Commit fd017d3

Browse files
committed
Add some assertions.
- Thin and fat LTO can't happen together. - `NeedsLink` and (non-allocator) `Compiled` work item results can't happen together.
1 parent 4f598b8 commit fd017d3

File tree

1 file changed

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

1 file changed

+4
-0
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
15351535
Ok(WorkItemResult::Finished(compiled_module)) => {
15361536
match compiled_module.kind {
15371537
ModuleKind::Regular => {
1538+
assert!(needs_link.is_empty());
15381539
compiled_modules.push(compiled_module);
15391540
}
15401541
ModuleKind::Allocator => {
@@ -1545,14 +1546,17 @@ fn start_executing_work<B: ExtraBackendMethods>(
15451546
}
15461547
}
15471548
Ok(WorkItemResult::NeedsLink(module)) => {
1549+
assert!(compiled_modules.is_empty());
15481550
needs_link.push(module);
15491551
}
15501552
Ok(WorkItemResult::NeedsFatLTO(fat_lto_input)) => {
15511553
assert!(!started_lto);
1554+
assert!(needs_thin_lto.is_empty());
15521555
needs_fat_lto.push(fat_lto_input);
15531556
}
15541557
Ok(WorkItemResult::NeedsThinLTO(name, thin_buffer)) => {
15551558
assert!(!started_lto);
1559+
assert!(needs_fat_lto.is_empty());
15561560
needs_thin_lto.push((name, thin_buffer));
15571561
}
15581562
Err(Some(WorkerFatalError)) => {

0 commit comments

Comments
 (0)