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