@@ -163,6 +163,7 @@ mod private {
163163#[ allow( private_interfaces) ]
164164pub trait Stage : Sized + ' static + Sealed {
165165 type Id : Copy ;
166+ const SHOULD_EMIT_LINTS : bool ;
166167
167168 fn parsers ( ) -> & ' static group_type ! ( Self ) ;
168169
@@ -173,6 +174,7 @@ pub trait Stage: Sized + 'static + Sealed {
173174#[ allow( private_interfaces) ]
174175impl Stage for Early {
175176 type Id = NodeId ;
177+ const SHOULD_EMIT_LINTS : bool = false ;
176178
177179 fn parsers ( ) -> & ' static group_type ! ( Self ) {
178180 & early:: ATTRIBUTE_PARSERS
@@ -186,6 +188,7 @@ impl Stage for Early {
186188#[ allow( private_interfaces) ]
187189impl Stage for Late {
188190 type Id = HirId ;
191+ const SHOULD_EMIT_LINTS : bool = true ;
189192
190193 fn parsers ( ) -> & ' static group_type ! ( Self ) {
191194 & late:: ATTRIBUTE_PARSERS
@@ -226,6 +229,9 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
226229 /// must be delayed until after HIR is built. This method will take care of the details of
227230 /// that.
228231 pub ( crate ) fn emit_lint ( & mut self , lint : AttributeLintKind , span : Span ) {
232+ if !S :: SHOULD_EMIT_LINTS {
233+ return ;
234+ }
229235 let id = self . target_id ;
230236 ( self . emit_lint ) ( AttributeLint { id, span, kind : lint } ) ;
231237 }
@@ -407,6 +413,10 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
407413 } ,
408414 } )
409415 }
416+
417+ pub ( crate ) fn warn_empty_attribute ( & mut self , span : Span ) {
418+ self . emit_lint ( AttributeLintKind :: EmptyAttribute { first_span : span } , span) ;
419+ }
410420}
411421
412422impl < ' f , ' sess , S : Stage > Deref for AcceptContext < ' f , ' sess , S > {
0 commit comments