Skip to content

Commit ed5a33d

Browse files
committed
Fix duplicate symbol ICE by adding logging system and stability_err
1 parent 5a19abe commit ed5a33d

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

compiler/rustc_attr_parsing/src/attributes/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ impl<S: Stage> AttributeParser<S> for RemovedFeatureParser {
597597
let since_symbol = match since {
598598
StableSince::Version(v) => Symbol::intern(&v.to_string()), // dynamic string — ok
599599
StableSince::Current => sym::current,
600-
StableSince::Err(_) => sym::err,
600+
StableSince::Err(_) => sym::stability_err,
601601
};
602602

603603
let removed = RemovedFeature {

compiler/rustc_span/src/symbol.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,6 @@ symbols! {
937937
eq,
938938
ergonomic_clones,
939939
ermsb_target_feature,
940-
err: "err",
941940
exact_div,
942941
except,
943942
exchange_malloc,
@@ -2096,6 +2095,7 @@ symbols! {
20962095
sse,
20972096
sse2,
20982097
sse4a_target_feature,
2098+
stability_err: "stability_err",
20992099
stable,
21002100
staged_api,
21012101
start,
@@ -2870,6 +2870,22 @@ impl Interner {
28702870
// effectively pre-interning all these strings for both `Symbol` and
28712871
// `ByteSymbol`.
28722872
fn prefill(init: &[&'static str], extra: &[&'static str]) -> Self {
2873+
let mut seen = FxIndexSet::default();
2874+
let mut duplicates = Vec::new();
2875+
2876+
for s in init.iter().chain(extra.iter()) {
2877+
if !seen.insert(s.as_bytes()) {
2878+
duplicates.push(*s);
2879+
}
2880+
}
2881+
2882+
if !duplicates.is_empty() {
2883+
eprintln!("Duplicate symbols detected in Interner prefill:");
2884+
for d in &duplicates {
2885+
eprintln!(" {}", d);
2886+
}
2887+
}
2888+
28732889
let byte_strs = FxIndexSet::from_iter(
28742890
init.iter().copied().chain(extra.iter().copied()).map(|str| str.as_bytes()),
28752891
);

0 commit comments

Comments
 (0)