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