@@ -5,14 +5,14 @@ use std::mem;
55use std:: ops:: { Deref , DerefMut } ;
66use std:: sync:: LazyLock ;
77
8- use rustc_ast:: { AttrStyle , MetaItemLit , NodeId } ;
8+ use rustc_ast:: { AttrStyle , MetaItemLit } ;
99use rustc_data_structures:: sync:: { DynSend , DynSync } ;
1010use rustc_errors:: { Diag , DiagCtxtHandle , Diagnostic , Level , MultiSpan } ;
1111use rustc_feature:: { AttrSuggestionStyle , AttributeTemplate } ;
1212use rustc_hir:: AttrPath ;
1313use rustc_hir:: attrs:: AttributeKind ;
14- use rustc_hir:: { AttrPath , HirId } ;
1514use rustc_parse:: parser:: Recovery ;
15+ use rustc_session:: Session ;
1616use rustc_session:: lint:: { Lint , LintId } ;
1717use rustc_span:: { ErrorGuaranteed , Span , Symbol } ;
1818
@@ -66,7 +66,6 @@ use crate::session_diagnostics::{
6666} ;
6767use crate :: target_checking:: AllowedTargets ;
6868use crate :: { AttributeParser , EmitAttribute } ;
69- use crate :: context:: private:: Sealed ;
7069
7170type GroupType = LazyLock < GroupTypeInner > ;
7271
@@ -89,20 +88,6 @@ pub(crate) type FinalizeFn = fn(&mut FinalizeContext<'_, '_>) -> Option<Attribut
8988macro_rules! attribute_parsers {
9089 (
9190 pub ( crate ) static $name: ident = [ $( $names: ty) ,* $( , ) ?] ;
92- ) => {
93- mod early {
94- use super :: * ;
95-
96- attribute_parsers!( @[ Early ] pub ( crate ) static $name = [ $( $names) ,* ] ; ) ;
97- }
98- mod late {
99- use super :: * ;
100-
101- attribute_parsers!( @[ Late ] pub ( crate ) static $name = [ $( $names) ,* ] ; ) ;
102- }
103- } ;
104- (
105- @[ $stage: ty] pub ( crate ) static $name: ident = [ $( $names: ty) ,* $( , ) ?] ;
10691 ) => {
10792 pub ( crate ) static $name: GroupType = LazyLock :: new( || {
10893 let mut accepters = BTreeMap :: <_, GroupTypeInnerAccept >:: new( ) ;
@@ -337,46 +322,6 @@ attribute_parsers!(
337322 ] ;
338323) ;
339324
340- mod private {
341- pub trait Sealed { }
342- impl Sealed for super :: Early { }
343- impl Sealed for super :: Late { }
344- }
345-
346- // allow because it's a sealed trait
347- #[ allow( private_interfaces) ]
348- pub trait Stage : Sized + ' static + Sealed {
349- type Id : Copy ;
350-
351- fn parsers ( ) -> & ' static GroupType ;
352- }
353-
354- // allow because it's a sealed trait
355- #[ allow( private_interfaces) ]
356- impl Stage for Early {
357- type Id = NodeId ;
358-
359- fn parsers ( ) -> & ' static GroupType {
360- & early:: ATTRIBUTE_PARSERS
361- }
362- }
363-
364- // allow because it's a sealed trait
365- #[ allow( private_interfaces) ]
366- impl Stage for Late {
367- type Id = HirId ;
368-
369- fn parsers ( ) -> & ' static GroupType {
370- & late:: ATTRIBUTE_PARSERS
371- }
372- }
373-
374- /// Used when parsing attributes for miscellaneous things *before* ast lowering
375- pub struct Early ;
376-
377- /// used when parsing attributes during ast lowering
378- pub struct Late ;
379-
380325/// Context given to every attribute parser when accepting
381326///
382327/// Gives [`AttributeParser`]s enough information to create errors, for example.
@@ -610,8 +555,6 @@ pub struct SharedContext<'p, 'sess> {
610555 pub ( crate ) target_span : Span ,
611556 pub ( crate ) target : rustc_hir:: Target ,
612557
613- /// The second argument of the closure is a [`NodeId`] if `S` is `Early` and a [`HirId`] if `S`
614- /// is `Late` and is the ID of the syntactical component this attribute was applied to.
615558 pub ( crate ) emit_lint : & ' p mut dyn FnMut ( LintId , MultiSpan , EmitAttribute ) ,
616559}
617560
0 commit comments