@@ -165,6 +165,7 @@ mod private {
165165#[ allow( private_interfaces) ]
166166pub trait Stage : Sized + ' static + Sealed {
167167 type Id : Copy ;
168+ const SHOULD_EMIT_LINTS : bool ;
168169
169170 fn parsers ( ) -> & ' static group_type ! ( Self ) ;
170171
@@ -175,6 +176,7 @@ pub trait Stage: Sized + 'static + Sealed {
175176#[ allow( private_interfaces) ]
176177impl Stage for Early {
177178 type Id = NodeId ;
179+ const SHOULD_EMIT_LINTS : bool = false ;
178180
179181 fn parsers ( ) -> & ' static group_type ! ( Self ) {
180182 & early:: ATTRIBUTE_PARSERS
@@ -188,6 +190,7 @@ impl Stage for Early {
188190#[ allow( private_interfaces) ]
189191impl Stage for Late {
190192 type Id = HirId ;
193+ const SHOULD_EMIT_LINTS : bool = true ;
191194
192195 fn parsers ( ) -> & ' static group_type ! ( Self ) {
193196 & late:: ATTRIBUTE_PARSERS
@@ -228,6 +231,9 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
228231 /// must be delayed until after HIR is built. This method will take care of the details of
229232 /// that.
230233 pub ( crate ) fn emit_lint ( & mut self , lint : AttributeLintKind , span : Span ) {
234+ if !S :: SHOULD_EMIT_LINTS {
235+ return ;
236+ }
231237 let id = self . target_id ;
232238 ( self . emit_lint ) ( AttributeLint { id, span, kind : lint } ) ;
233239 }
@@ -409,6 +415,10 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
409415 } ,
410416 } )
411417 }
418+
419+ pub ( crate ) fn warn_empty_attribute ( & mut self , span : Span ) {
420+ self . emit_lint ( AttributeLintKind :: EmptyAttribute { first_span : span } , span) ;
421+ }
412422}
413423
414424impl < ' f , ' sess , S : Stage > Deref for AcceptContext < ' f , ' sess , S > {
0 commit comments