@@ -11,7 +11,6 @@ use crate::context::{AcceptContext, Stage};
1111use crate :: parser:: ArgParser ;
1212
1313pub ( crate ) struct SkipDuringMethodDispatchParser ;
14-
1514impl < S : Stage > SingleAttributeParser < S > for SkipDuringMethodDispatchParser {
1615 const PATH : & [ Symbol ] = & [ sym:: rustc_skip_during_method_dispatch] ;
1716 const ATTRIBUTE_ORDER : AttributeOrder = AttributeOrder :: KeepFirst ;
@@ -55,85 +54,27 @@ impl<S: Stage> SingleAttributeParser<S> for SkipDuringMethodDispatchParser {
5554 }
5655}
5756
58- pub ( crate ) struct ConstTraitParser ;
59- impl < S : Stage > NoArgsAttributeParser < S > for ConstTraitParser {
60- const PATH : & [ Symbol ] = & [ sym:: const_trait] ;
61- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Warn ;
57+ impl_no_args ! ( ParenSugarParser : rustc_paren_sugar => ParenSugar / Error ) ;
58+ impl_no_args ! ( TypeConstParser : type_const => TypeConst / Error ) ;
6259
63- fn create ( span : Span ) -> AttributeKind {
64- AttributeKind :: ConstTrait ( span)
65- }
66- }
67-
68- pub ( crate ) struct DenyExplicitImplParser ;
69- impl < S : Stage > NoArgsAttributeParser < S > for DenyExplicitImplParser {
70- const PATH : & [ Symbol ] = & [ sym:: rustc_deny_explicit_impl] ;
71- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
60+ // Markers
7261
73- fn create ( span : Span ) -> AttributeKind {
74- AttributeKind :: DenyExplicitImpl ( span)
75- }
76- }
77-
78- pub ( crate ) struct DoNotImplementViaObjectParser ;
79- impl < S : Stage > NoArgsAttributeParser < S > for DoNotImplementViaObjectParser {
80- const PATH : & [ Symbol ] = & [ sym:: rustc_do_not_implement_via_object] ;
81- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
62+ impl_no_args ! ( MarkerParser : marker => Marker / Error ) ;
63+ impl_no_args ! ( DenyExplicitImplParser : rustc_deny_explicit_impl => DenyExplicitImpl / Error ) ;
64+ impl_no_args ! ( DoNotImplementViaObjectParser : rustc_do_not_implement_via_object => DoNotImplementViaObject / Error ) ;
8265
83- fn create ( span : Span ) -> AttributeKind {
84- AttributeKind :: DoNotImplementViaObject ( span)
85- }
86- }
66+ // Const traits
8767
88- pub ( crate ) struct CoinductiveParser ;
89- impl < S : Stage > NoArgsAttributeParser < S > for CoinductiveParser {
90- const PATH : & [ Symbol ] = & [ sym:: rustc_coinductive] ;
91- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
68+ impl_no_args ! ( ConstTraitParser : const_trait => ConstTrait / Warn ) ;
9269
93- fn create ( span : Span ) -> AttributeKind {
94- AttributeKind :: Coinductive ( span)
95- }
96- }
70+ // Specialization
9771
98- pub ( crate ) struct TypeConstParser ;
99- impl < S : Stage > NoArgsAttributeParser < S > for TypeConstParser {
100- const PATH : & [ Symbol ] = & [ sym:: type_const] ;
101- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
72+ impl_no_args ! ( SpecializationTraitParser : rustc_specialization_trait => SpecializationTrait / Error ) ;
73+ impl_no_args ! ( UnsafeSpecializationMarkerParser : rustc_unsafe_specialization_marker => UnsafeSpecializationMarker / Error ) ;
10274
103- fn create ( span : Span ) -> AttributeKind {
104- AttributeKind :: TypeConst ( span)
105- }
106- }
75+ // Coherence
10776
108- pub ( crate ) struct SpecializationTraitParser ;
109- impl < S : Stage > NoArgsAttributeParser < S > for SpecializationTraitParser {
110- const PATH : & [ Symbol ] = & [ sym:: rustc_specialization_trait] ;
111- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
112-
113- fn create ( span : Span ) -> AttributeKind {
114- AttributeKind :: SpecializationTrait ( span)
115- }
116- }
117-
118- pub ( crate ) struct UnsafeSpecializationMarkerParser ;
119- impl < S : Stage > NoArgsAttributeParser < S > for UnsafeSpecializationMarkerParser {
120- const PATH : & [ Symbol ] = & [ sym:: rustc_unsafe_specialization_marker] ;
121- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
122-
123- fn create ( span : Span ) -> AttributeKind {
124- AttributeKind :: UnsafeSpecializationMarker ( span)
125- }
126- }
127-
128- pub ( crate ) struct MarkerParser ;
129- impl < S : Stage > NoArgsAttributeParser < S > for MarkerParser {
130- const PATH : & [ Symbol ] = & [ sym:: marker] ;
131- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Warn ;
132-
133- fn create ( span : Span ) -> AttributeKind {
134- AttributeKind :: Marker ( span)
135- }
136- }
77+ impl_no_args ! ( CoinductiveParser : rustc_coinductive => Coinductive / Error ) ;
13778
13879pub ( crate ) struct FundamentalParser ;
13980impl < S : Stage > NoArgsAttributeParser < S > for FundamentalParser {
@@ -144,13 +85,3 @@ impl<S: Stage> NoArgsAttributeParser<S> for FundamentalParser {
14485 AttributeKind :: Fundamental
14586 }
14687}
147-
148- pub ( crate ) struct ParenSugarParser ;
149- impl < S : Stage > NoArgsAttributeParser < S > for ParenSugarParser {
150- const PATH : & [ Symbol ] = & [ sym:: rustc_paren_sugar] ;
151- const ON_DUPLICATE : OnDuplicate < S > = OnDuplicate :: Error ;
152-
153- fn create ( span : Span ) -> AttributeKind {
154- AttributeKind :: ParenSugar ( span)
155- }
156- }
0 commit comments