diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index b8cf472309ba5..f6ae748560750 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -19,6 +19,7 @@ #![allow(internal_features)] #![cfg_attr(target_arch = "loongarch64", feature(stdarch_loongarch))] #![feature(core_io_borrowed_buf)] +#![feature(diagnostic_on_unknown)] #![feature(map_try_insert)] #![feature(negative_impls)] #![feature(read_buf)] diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 07d6eb03ae8da..801f16c0a308b 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -2927,9 +2927,13 @@ pub mod kw { /// /// Given that `sym` is imported, use them like `sym::symbol_name`. /// For example `sym::rustfmt` or `sym::u8`. +#[diagnostic::on_unknown( + label = "`{Unresolved}` is not a pre-interned symbol", + note = "consider adding `{Unresolved}` to the `symbols!` invocation in compiler/rustc_span/src/symbol.rs" +)] pub mod sym { - // Used from a macro in `librustc_feature/accepted.rs` use super::Symbol; + // Used from a macro in `librustc_feature/accepted.rs` pub use super::kw::MacroRules as macro_rules; #[doc(inline)] pub use super::sym_generated::*;