@@ -160,6 +160,7 @@ mod private {
160160#[ allow( private_interfaces) ]  
161161pub  trait  Stage :  Sized  + ' static  + Sealed  { 
162162    type  Id :  Copy ; 
163+     const  SHOULD_EMIT_LINTS :  bool ; 
163164
164165    fn  parsers ( )  -> & ' static  group_type ! ( Self ) ; 
165166
@@ -170,6 +171,7 @@ pub trait Stage: Sized + 'static + Sealed {
170171#[ allow( private_interfaces) ]  
171172impl  Stage  for  Early  { 
172173    type  Id  = NodeId ; 
174+     const  SHOULD_EMIT_LINTS :  bool  = false ; 
173175
174176    fn  parsers ( )  -> & ' static  group_type ! ( Self )  { 
175177        & early:: ATTRIBUTE_PARSERS 
@@ -183,6 +185,7 @@ impl Stage for Early {
183185#[ allow( private_interfaces) ]  
184186impl  Stage  for  Late  { 
185187    type  Id  = HirId ; 
188+     const  SHOULD_EMIT_LINTS :  bool  = true ; 
186189
187190    fn  parsers ( )  -> & ' static  group_type ! ( Self )  { 
188191        & late:: ATTRIBUTE_PARSERS 
@@ -223,6 +226,9 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
223226/// must be delayed until after HIR is built. This method will take care of the details of 
224227/// that. 
225228pub ( crate )  fn  emit_lint ( & mut  self ,  lint :  AttributeLintKind ,  span :  Span )  { 
229+         if  !S :: SHOULD_EMIT_LINTS  { 
230+             return ; 
231+         } 
226232        let  id = self . target_id ; 
227233        ( self . emit_lint ) ( AttributeLint  {  id,  span,  kind :  lint } ) ; 
228234    } 
@@ -404,6 +410,10 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
404410            } , 
405411        } ) 
406412    } 
413+ 
414+     pub ( crate )  fn  warn_empty_attribute ( & mut  self ,  span :  Span )  { 
415+         self . emit_lint ( AttributeLintKind :: EmptyAttribute  {  first_span :  span } ,  span) ; 
416+     } 
407417} 
408418
409419impl < ' f ,  ' sess ,  S :  Stage >  Deref  for  AcceptContext < ' f ,  ' sess ,  S >  { 
0 commit comments