diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index b6195d3bbc4a6..022ae370b7872 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -333,7 +333,8 @@ impl Ident { panic!("`{:?}` is not a valid identifier", string) } if is_raw && !sym.can_be_raw() { - panic!("`{}` cannot be a raw identifier", string); + sess.span_diagnostic + .delay_span_bug(span, &format!("`{}` cannot be a raw identifier", string)); } sess.symbol_gallery.insert(sym, span); Ident { sym, is_raw, span }