@@ -721,3 +721,53 @@ impl<S: Stage> CombineAttributeParser<S> for RustcThenThisWouldNeedParser {
721721 Some ( ident)
722722 }
723723}
724+
725+ pub ( crate ) struct RustcSymbolName ;
726+
727+ impl < S : Stage > SingleAttributeParser < S > for RustcSymbolName {
728+ const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [
729+ Allow ( Target :: Fn ) ,
730+ Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
731+ Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
732+ Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
733+ Allow ( Target :: ForeignFn ) ,
734+ Allow ( Target :: ForeignStatic ) ,
735+ Allow ( Target :: Impl { of_trait : false } ) ,
736+ ] ) ;
737+ const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
738+ const PATH : & [ Symbol ] = & [ sym:: rustc_symbol_name] ;
739+ const ATTRIBUTE_ORDER : AttributeOrder = AttributeOrder :: KeepInnermost ;
740+ const TEMPLATE : AttributeTemplate = template ! ( Word ) ;
741+ fn convert ( cx : & mut AcceptContext < ' _ , ' _ , S > , args : & ArgParser ) -> Option < AttributeKind > {
742+ if let Err ( span) = args. no_args ( ) {
743+ cx. expected_no_args ( span) ;
744+ return None ;
745+ }
746+ Some ( AttributeKind :: RustcSymbolName ( cx. attr_span ) )
747+ }
748+ }
749+
750+ pub ( crate ) struct RustcDefPath ;
751+
752+ impl < S : Stage > SingleAttributeParser < S > for RustcDefPath {
753+ const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [
754+ Allow ( Target :: Fn ) ,
755+ Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
756+ Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
757+ Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
758+ Allow ( Target :: ForeignFn ) ,
759+ Allow ( Target :: ForeignStatic ) ,
760+ Allow ( Target :: Impl { of_trait : false } ) ,
761+ ] ) ;
762+ const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
763+ const PATH : & [ Symbol ] = & [ sym:: rustc_def_path] ;
764+ const ATTRIBUTE_ORDER : AttributeOrder = AttributeOrder :: KeepInnermost ;
765+ const TEMPLATE : AttributeTemplate = template ! ( Word ) ;
766+ fn convert ( cx : & mut AcceptContext < ' _ , ' _ , S > , args : & ArgParser ) -> Option < AttributeKind > {
767+ if let Err ( span) = args. no_args ( ) {
768+ cx. expected_no_args ( span) ;
769+ return None ;
770+ }
771+ Some ( AttributeKind :: RustcDefPath ( cx. attr_span ) )
772+ }
773+ }
0 commit comments