@@ -633,29 +633,7 @@ impl<S: Stage> SingleAttributeParser<S> for LangParser {
633633 const PATH : & [ Symbol ] = & [ sym:: lang] ;
634634 const ATTRIBUTE_ORDER : AttributeOrder = AttributeOrder :: KeepInnermost ;
635635 const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
636- const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [
637- Allow ( Target :: Trait ) ,
638- Allow ( Target :: Struct ) ,
639- Allow ( Target :: Enum ) ,
640- Allow ( Target :: Variant ) ,
641- Allow ( Target :: Union ) ,
642- Allow ( Target :: MacroDef ) ,
643- Allow ( Target :: TyAlias ) ,
644- Allow ( Target :: AssocTy ) ,
645- Allow ( Target :: AssocConst ) ,
646- Allow ( Target :: Fn ) ,
647- Allow ( Target :: ForeignFn ) ,
648- Allow ( Target :: Const ) ,
649- Allow ( Target :: Mod ) ,
650- Allow ( Target :: Impl { of_trait : false } ) ,
651- Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
652- Allow ( Target :: Method ( MethodKind :: Trait { body : false } ) ) ,
653- Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
654- Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
655- Allow ( Target :: Crate ) ,
656- Allow ( Target :: Static ) ,
657- Allow ( Target :: ForeignStatic ) ,
658- ] ) ;
636+ const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( ALL_TARGETS ) ; // Targets are checked per lang item in `rustc_passes`
659637 const TEMPLATE : AttributeTemplate = template ! ( NameValueStr : "name" ) ;
660638
661639 fn convert ( cx : & mut AcceptContext < ' _ , ' _ , S > , args : & ArgParser ) -> Option < AttributeKind > {
@@ -675,6 +653,15 @@ impl<S: Stage> SingleAttributeParser<S> for LangParser {
675653 }
676654}
677655
656+ pub ( crate ) struct PanicHandlerParser ;
657+
658+ impl < S : Stage > NoArgsAttributeParser < S > for PanicHandlerParser {
659+ const PATH : & [ Symbol ] = & [ sym:: panic_handler] ;
660+ const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
661+ const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( ALL_TARGETS ) ; // Targets are checked per lang item in `rustc_passes`
662+ const CREATE : fn ( Span ) -> AttributeKind = |_| AttributeKind :: Lang ( LangItem :: PanicImpl ) ;
663+ }
664+
678665pub ( crate ) struct RustcHasIncoherentInherentImplsParser ;
679666
680667impl < S : Stage > NoArgsAttributeParser < S > for RustcHasIncoherentInherentImplsParser {
0 commit comments