Skip to content

Commit a7532d9

Browse files
authored
Rollup merge of rust-lang#113402 - nnethercote:diagnose-unsorted-CGUs, r=lqd
Diagnose unsorted CGUs. An assertion failure was reported in rust-lang#112946. This extra information will help diagnose the problem. r? `@lqd`
2 parents 72e0e17 + fc85366 commit a7532d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_monomorphize/src/partitioning.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ where
187187
}
188188

189189
// Ensure CGUs are sorted by name, so that we get deterministic results.
190-
assert!(codegen_units.is_sorted_by(|a, b| Some(a.name().as_str().cmp(b.name().as_str()))));
190+
if !codegen_units.is_sorted_by(|a, b| Some(a.name().as_str().cmp(b.name().as_str()))) {
191+
let mut names = String::new();
192+
for cgu in codegen_units.iter() {
193+
names += &format!("- {}\n", cgu.name());
194+
}
195+
bug!("unsorted CGUs:\n{names}");
196+
}
191197

192198
codegen_units
193199
}

0 commit comments

Comments
 (0)