Skip to content

Commit fc85366

Browse files
committed
Diagnose unsorted CGUs.
An assertion failure was reported in #112946. This extra information will help diagnose the problem.
1 parent d9c13cd commit fc85366

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_monomorphize/src/partitioning.rs

+7-1
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)