@@ -161,6 +161,7 @@ mod private {
161161#[ allow( private_interfaces) ]
162162pub trait Stage : Sized + ' static + Sealed {
163163 type Id : Copy ;
164+ const SHOULD_EMIT_LINTS : bool ;
164165
165166 fn parsers ( ) -> & ' static group_type ! ( Self ) ;
166167
@@ -171,6 +172,7 @@ pub trait Stage: Sized + 'static + Sealed {
171172#[ allow( private_interfaces) ]
172173impl Stage for Early {
173174 type Id = NodeId ;
175+ const SHOULD_EMIT_LINTS : bool = false ;
174176
175177 fn parsers ( ) -> & ' static group_type ! ( Self ) {
176178 & early:: ATTRIBUTE_PARSERS
@@ -184,6 +186,7 @@ impl Stage for Early {
184186#[ allow( private_interfaces) ]
185187impl Stage for Late {
186188 type Id = HirId ;
189+ const SHOULD_EMIT_LINTS : bool = true ;
187190
188191 fn parsers ( ) -> & ' static group_type ! ( Self ) {
189192 & late:: ATTRIBUTE_PARSERS
@@ -224,6 +227,9 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
224227 /// must be delayed until after HIR is built. This method will take care of the details of
225228 /// that.
226229 pub ( crate ) fn emit_lint ( & mut self , lint : AttributeLintKind , span : Span ) {
230+ if !S :: SHOULD_EMIT_LINTS {
231+ return ;
232+ }
227233 let id = self . target_id ;
228234 ( self . emit_lint ) ( AttributeLint { id, span, kind : lint } ) ;
229235 }
@@ -405,6 +411,10 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
405411 } ,
406412 } )
407413 }
414+
415+ pub ( crate ) fn warn_empty_attribute ( & mut self , span : Span ) {
416+ self . emit_lint ( AttributeLintKind :: EmptyAttribute { first_span : span } , span) ;
417+ }
408418}
409419
410420impl < ' f , ' sess , S : Stage > Deref for AcceptContext < ' f , ' sess , S > {
0 commit comments