about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_monomorphize/src/partitioning.rs8
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
 }