diff --git a/external-crates/move/crates/move-bytecode-utils/src/lib.rs b/external-crates/move/crates/move-bytecode-utils/src/lib.rs index c2af29e185dd64..456ef27c2fb800 100644 --- a/external-crates/move/crates/move-bytecode-utils/src/lib.rs +++ b/external-crates/move/crates/move-bytecode-utils/src/lib.rs @@ -25,10 +25,12 @@ impl<'a> Modules<'a> { pub fn new(modules: impl IntoIterator) -> Self { let mut map = BTreeMap::new(); for m in modules { - assert!( - map.insert(m.self_id(), m).is_none(), - "Duplicate module found" - ); + if let Some(prev) = map.insert(m.self_id(), m) { + panic!( + "Duplicate module found: {}", + prev.self_id().to_canonical_display(/* with_prefix */ true) + ) + } } Modules(map) }