From 47e7f7e9e9752ee3c3185398c87c4dc8c9118561 Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Tue, 11 Aug 2026 23:41:23 +0200 Subject: [PATCH 1/2] dogfood diagnostic::on_unknown --- compiler/rustc_span/src/lib.rs | 1 + compiler/rustc_span/src/symbol.rs | 4 ++++ 2 files changed, 5 insertions(+) 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..5a797279ccc3d 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -2927,6 +2927,10 @@ 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; From 77d3d5bc5d19b79d9779f8199e3ea2d205a19fab Mon Sep 17 00:00:00 2001 From: mejrs <59372212+mejrs@users.noreply.github.com> Date: Tue, 11 Aug 2026 23:53:39 +0200 Subject: [PATCH 2/2] Fix macro_rules symbol comment --- compiler/rustc_span/src/symbol.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 5a797279ccc3d..801f16c0a308b 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -2932,8 +2932,8 @@ pub mod kw { 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::*;