Skip to content

Commit eba0934

Browse files
committed
report duplicate symbol added by the driver
1 parent 68baa87 commit eba0934

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

compiler/rustc_span/src/symbol.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::ops::Deref;
77
use std::{fmt, str};
88

99
use rustc_arena::DroplessArena;
10-
use rustc_data_structures::fx::FxIndexSet;
10+
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
1111
use rustc_data_structures::stable_hasher::{
1212
HashStable, StableCompare, StableHasher, ToStableHashKey,
1313
};
@@ -2868,11 +2868,20 @@ impl Interner {
28682868
let byte_strs = FxIndexSet::from_iter(
28692869
init.iter().copied().chain(extra.iter().copied()).map(|str| str.as_bytes()),
28702870
);
2871-
assert_eq!(
2872-
byte_strs.len(),
2873-
init.len() + extra.len(),
2874-
"duplicate symbols in the rustc symbol list and the extra symbols added by the driver",
2875-
);
2871+
2872+
// The order in which duplicates are reported is irrelevant.
2873+
#[expect(rustc::potential_query_instability)]
2874+
if byte_strs.len() != init.len() + extra.len() {
2875+
panic!(
2876+
"duplicate symbols in the rustc symbol list and the extra symbols added by the driver: {:?}",
2877+
FxHashSet::intersection(
2878+
&init.iter().copied().collect(),
2879+
&extra.iter().copied().collect(),
2880+
)
2881+
.collect::<Vec<_>>()
2882+
)
2883+
}
2884+
28762885
Interner(Lock::new(InternerInner { arena: Default::default(), byte_strs }))
28772886
}
28782887

0 commit comments

Comments
 (0)