@@ -163,6 +163,7 @@ mod private {
163
163
#[ allow( private_interfaces) ]
164
164
pub trait Stage : Sized + ' static + Sealed {
165
165
type Id : Copy ;
166
+ const SHOULD_EMIT_LINTS : bool ;
166
167
167
168
fn parsers ( ) -> & ' static group_type ! ( Self ) ;
168
169
@@ -173,6 +174,7 @@ pub trait Stage: Sized + 'static + Sealed {
173
174
#[ allow( private_interfaces) ]
174
175
impl Stage for Early {
175
176
type Id = NodeId ;
177
+ const SHOULD_EMIT_LINTS : bool = false ;
176
178
177
179
fn parsers ( ) -> & ' static group_type ! ( Self ) {
178
180
& early:: ATTRIBUTE_PARSERS
@@ -186,6 +188,7 @@ impl Stage for Early {
186
188
#[ allow( private_interfaces) ]
187
189
impl Stage for Late {
188
190
type Id = HirId ;
191
+ const SHOULD_EMIT_LINTS : bool = true ;
189
192
190
193
fn parsers ( ) -> & ' static group_type ! ( Self ) {
191
194
& late:: ATTRIBUTE_PARSERS
@@ -226,6 +229,9 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
226
229
/// must be delayed until after HIR is built. This method will take care of the details of
227
230
/// that.
228
231
pub ( crate ) fn emit_lint ( & mut self , lint : AttributeLintKind , span : Span ) {
232
+ if !S :: SHOULD_EMIT_LINTS {
233
+ return ;
234
+ }
229
235
let id = self . target_id ;
230
236
( self . emit_lint ) ( AttributeLint { id, span, kind : lint } ) ;
231
237
}
@@ -407,6 +413,10 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
407
413
} ,
408
414
} )
409
415
}
416
+
417
+ pub ( crate ) fn warn_empty_attribute ( & mut self , span : Span ) {
418
+ self . emit_lint ( AttributeLintKind :: EmptyAttribute { first_span : span } , span) ;
419
+ }
410
420
}
411
421
412
422
impl < ' f , ' sess , S : Stage > Deref for AcceptContext < ' f , ' sess , S > {
0 commit comments