@@ -4,8 +4,7 @@ use rustc_ast::{LitIntType, LitKind, MetaItemLit};
44use rustc_hir:: LangItem ;
55use rustc_hir:: attrs:: {
66 BorrowckGraphvizFormatKind , CguFields , CguKind , DivergingBlockBehavior ,
7- DivergingFallbackBehavior , RustcCleanAttribute , RustcCleanQueries , RustcLayoutType ,
8- RustcMirKind ,
7+ DivergingFallbackBehavior , RustcCleanAttribute , RustcCleanQueries , RustcMirKind ,
98} ;
109use rustc_session:: errors;
1110use rustc_span:: Symbol ;
@@ -681,14 +680,6 @@ impl<S: Stage> NoArgsAttributeParser<S> for PanicHandlerParser {
681680 const CREATE : fn ( Span ) -> AttributeKind = |span| AttributeKind :: Lang ( LangItem :: PanicImpl , span) ;
682681}
683682
684- pub ( crate ) struct RustcHiddenTypeOfOpaquesParser ;
685-
686- impl < S : Stage > NoArgsAttributeParser < S > for RustcHiddenTypeOfOpaquesParser {
687- const PATH : & [ Symbol ] = & [ sym:: rustc_hidden_type_of_opaques] ;
688- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
689- const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [ Allow ( Target :: Crate ) ] ) ;
690- const CREATE : fn ( Span ) -> AttributeKind = |_| AttributeKind :: RustcHiddenTypeOfOpaques ;
691- }
692683pub ( crate ) struct RustcNounwindParser ;
693684
694685impl < S : Stage > NoArgsAttributeParser < S > for RustcNounwindParser {
@@ -713,64 +704,6 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcOffloadKernelParser {
713704 const CREATE : fn ( Span ) -> AttributeKind = |_| AttributeKind :: RustcOffloadKernel ;
714705}
715706
716- pub ( crate ) struct RustcLayoutParser ;
717-
718- impl < S : Stage > CombineAttributeParser < S > for RustcLayoutParser {
719- const PATH : & [ Symbol ] = & [ sym:: rustc_layout] ;
720-
721- type Item = RustcLayoutType ;
722-
723- const CONVERT : ConvertFn < Self :: Item > = |items, _| AttributeKind :: RustcLayout ( items) ;
724-
725- const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [
726- Allow ( Target :: Struct ) ,
727- Allow ( Target :: Enum ) ,
728- Allow ( Target :: Union ) ,
729- Allow ( Target :: TyAlias ) ,
730- ] ) ;
731-
732- const TEMPLATE : AttributeTemplate =
733- template ! ( List : & [ "abi" , "align" , "size" , "homogenous_aggregate" , "debug" ] ) ;
734- fn extend (
735- cx : & mut AcceptContext < ' _ , ' _ , S > ,
736- args : & ArgParser ,
737- ) -> impl IntoIterator < Item = Self :: Item > {
738- let ArgParser :: List ( items) = args else {
739- let attr_span = cx. attr_span ;
740- cx. adcx ( ) . expected_list ( attr_span, args) ;
741- return vec ! [ ] ;
742- } ;
743-
744- let mut result = Vec :: new ( ) ;
745- for item in items. mixed ( ) {
746- let Some ( arg) = item. meta_item ( ) else {
747- cx. adcx ( ) . expected_not_literal ( item. span ( ) ) ;
748- continue ;
749- } ;
750- let Some ( ident) = arg. ident ( ) else {
751- cx. adcx ( ) . expected_identifier ( arg. span ( ) ) ;
752- return vec ! [ ] ;
753- } ;
754- let ty = match ident. name {
755- sym:: abi => RustcLayoutType :: Abi ,
756- sym:: align => RustcLayoutType :: Align ,
757- sym:: size => RustcLayoutType :: Size ,
758- sym:: homogeneous_aggregate => RustcLayoutType :: HomogenousAggregate ,
759- sym:: debug => RustcLayoutType :: Debug ,
760- _ => {
761- cx. adcx ( ) . expected_specific_argument (
762- ident. span ,
763- & [ sym:: abi, sym:: align, sym:: size, sym:: homogeneous_aggregate, sym:: debug] ,
764- ) ;
765- continue ;
766- }
767- } ;
768- result. push ( ty) ;
769- }
770- result
771- }
772- }
773-
774707pub ( crate ) struct RustcMirParser ;
775708
776709impl < S : Stage > CombineAttributeParser < S > for RustcMirParser {
@@ -1210,54 +1143,6 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcNonnullOptimizationGuaranteedPa
12101143 const CREATE : fn ( Span ) -> AttributeKind = |_| AttributeKind :: RustcNonnullOptimizationGuaranteed ;
12111144}
12121145
1213- pub ( crate ) struct RustcSymbolNameParser ;
1214-
1215- impl < S : Stage > SingleAttributeParser < S > for RustcSymbolNameParser {
1216- const PATH : & [ Symbol ] = & [ sym:: rustc_symbol_name] ;
1217- const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [
1218- Allow ( Target :: Fn ) ,
1219- Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
1220- Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
1221- Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
1222- Allow ( Target :: ForeignFn ) ,
1223- Allow ( Target :: ForeignStatic ) ,
1224- Allow ( Target :: Impl { of_trait : false } ) ,
1225- ] ) ;
1226- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
1227- const TEMPLATE : AttributeTemplate = template ! ( Word ) ;
1228- fn convert ( cx : & mut AcceptContext < ' _ , ' _ , S > , args : & ArgParser ) -> Option < AttributeKind > {
1229- if let Err ( span) = args. no_args ( ) {
1230- cx. adcx ( ) . expected_no_args ( span) ;
1231- return None ;
1232- }
1233- Some ( AttributeKind :: RustcSymbolName ( cx. attr_span ) )
1234- }
1235- }
1236-
1237- pub ( crate ) struct RustcDefPathParser ;
1238-
1239- impl < S : Stage > SingleAttributeParser < S > for RustcDefPathParser {
1240- const PATH : & [ Symbol ] = & [ sym:: rustc_def_path] ;
1241- const ALLOWED_TARGETS : AllowedTargets = AllowedTargets :: AllowList ( & [
1242- Allow ( Target :: Fn ) ,
1243- Allow ( Target :: Method ( MethodKind :: TraitImpl ) ) ,
1244- Allow ( Target :: Method ( MethodKind :: Inherent ) ) ,
1245- Allow ( Target :: Method ( MethodKind :: Trait { body : true } ) ) ,
1246- Allow ( Target :: ForeignFn ) ,
1247- Allow ( Target :: ForeignStatic ) ,
1248- Allow ( Target :: Impl { of_trait : false } ) ,
1249- ] ) ;
1250- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
1251- const TEMPLATE : AttributeTemplate = template ! ( Word ) ;
1252- fn convert ( cx : & mut AcceptContext < ' _ , ' _ , S > , args : & ArgParser ) -> Option < AttributeKind > {
1253- if let Err ( span) = args. no_args ( ) {
1254- cx. adcx ( ) . expected_no_args ( span) ;
1255- return None ;
1256- }
1257- Some ( AttributeKind :: RustcDefPath ( cx. attr_span ) )
1258- }
1259- }
1260-
12611146pub ( crate ) struct RustcStrictCoherenceParser ;
12621147
12631148impl < S : Stage > NoArgsAttributeParser < S > for RustcStrictCoherenceParser {
0 commit comments