@@ -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} ;
@@ -716,16 +717,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
716717 {
717718 // Turn ambiguity errors for core vs std panic into warnings.
718719 // FIXME: Remove with lang team approval.
719- let is_issue_147319_hack = matches ! (
720- ( binding. res( ) , innermost_binding. res( ) ) ,
721- (
722- Res :: Def ( DefKind :: Macro ( _) , def_id_core) ,
723- Res :: Def ( DefKind :: Macro ( _) , def_id_std)
724- ) if this. tcx. def_path_debug_str( def_id_core)
725- == "core[234c]::macros::panic"
726- && this. tcx. def_path_debug_str( def_id_std)
727- == "std[d474]::macros::panic"
728- ) ;
720+ let is_issue_147319_hack = ctxt. edition ( )
721+ <= Edition :: Edition2024
722+ && matches ! ( orig_ident. name, sym:: panic)
723+ && this. is_builtin_macro ( binding. res ( ) )
724+ && this. is_builtin_macro ( innermost_binding. res ( ) ) ;
729725
730726 let warning = if is_issue_147319_hack {
731727 Some ( AmbiguityWarning :: PanicImport )
0 commit comments