@@ -6,6 +6,7 @@ use rustc_hir::def::{DefKind, MacroKinds, Namespace, NonMacroAttrKind, PartialRe
66use rustc_middle:: { bug, span_bug} ;
77use rustc_session:: lint:: builtin:: PROC_MACRO_DERIVE_RESOLUTION_FALLBACK ;
88use rustc_session:: parse:: feature_err;
9+ use rustc_span:: edition:: Edition ;
910use rustc_span:: hygiene:: { ExpnId , ExpnKind , LocalExpnId , MacroKind , SyntaxContext } ;
1011use rustc_span:: { Ident , Span , kw, sym} ;
1112use tracing:: { debug, instrument} ;
@@ -715,16 +716,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
715716 {
716717 // Turn ambiguity errors for core vs std panic into warnings.
717718 // FIXME: Remove with lang team approval.
718- let is_issue_147319_hack = matches ! (
719- ( binding. res( ) , innermost_binding. res( ) ) ,
720- (
721- Res :: Def ( DefKind :: Macro ( _) , def_id_core) ,
722- Res :: Def ( DefKind :: Macro ( _) , def_id_std)
723- ) if this. tcx. def_path_debug_str( def_id_core)
724- == "core[234c]::macros::panic"
725- && this. tcx. def_path_debug_str( def_id_std)
726- == "std[d474]::macros::panic"
727- ) ;
719+ let is_issue_147319_hack = ctxt. edition ( )
720+ <= Edition :: Edition2024
721+ && matches ! ( orig_ident. name, sym:: panic)
722+ && this. is_builtin_macro ( binding. res ( ) )
723+ && this. is_builtin_macro ( innermost_binding. res ( ) ) ;
728724
729725 let warning = if is_issue_147319_hack {
730726 Some ( AmbiguityWarning :: PanicImport )
0 commit comments