Skip to content

Commit c58a6c9

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

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
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_hir/src/attrs/data_structures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ pub enum AttributeKind {
622622
/// Represents [`#[recursion_limit]`](https://doc.rust-lang.org/reference/attributes/limits.html#the-recursion_limit-attribute)
623623
RecursionLimit { attr_span: Span, limit_span: Span, limit: Limit },
624624

625-
/// Represents `#[]`
625+
/// Represents a removed or obsolete compiler or library feature (e.g., a previously allowed `#![feature(...)]`).
626626
RemovedFeature(RemovedFeature),
627627

628628
/// Represents [`#[repr]`](https://doc.rust-lang.org/stable/reference/type-layout.html#representations).

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)