diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-07-06 17:51:18 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-07-06 18:27:25 +1000 |
| commit | fc8536669ca9b1a3820da9f29dc01d87a44ee151 (patch) | |
| tree | 67b4f3217317ffa63fd38f7311842b6c5544fc13 /compiler/rustc_monomorphize/src | |
| parent | d9c13cd4531649c2028a8384cb4d4e54f985380e (diff) | |
| download | rust-fc8536669ca9b1a3820da9f29dc01d87a44ee151.tar.gz rust-fc8536669ca9b1a3820da9f29dc01d87a44ee151.zip | |
Diagnose unsorted CGUs.
An assertion failure was reported in #112946. This extra information will help diagnose the problem.
Diffstat (limited to 'compiler/rustc_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/partitioning.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_monomorphize/src/partitioning.rs b/compiler/rustc_monomorphize/src/partitioning.rs index e663f4486f7..f4535fbd58f 100644 --- a/compiler/rustc_monomorphize/src/partitioning.rs +++ b/compiler/rustc_monomorphize/src/partitioning.rs @@ -187,7 +187,13 @@ where } // Ensure CGUs are sorted by name, so that we get deterministic results. - assert!(codegen_units.is_sorted_by(|a, b| Some(a.name().as_str().cmp(b.name().as_str())))); + if !codegen_units.is_sorted_by(|a, b| Some(a.name().as_str().cmp(b.name().as_str()))) { + let mut names = String::new(); + for cgu in codegen_units.iter() { + names += &format!("- {}\n", cgu.name()); + } + bug!("unsorted CGUs:\n{names}"); + } codegen_units } |
