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