@@ -5,14 +5,13 @@ 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 ;
1414use rustc_hir:: lints:: AttributeLintKind ;
15- use rustc_hir:: { AttrPath , HirId } ;
1615use rustc_parse:: parser:: Recovery ;
1716use rustc_session:: lint:: { Lint , LintId } ;
1817use rustc_span:: { ErrorGuaranteed , Span , Symbol } ;
@@ -67,7 +66,6 @@ use crate::session_diagnostics::{
6766} ;
6867use crate :: target_checking:: AllowedTargets ;
6968use crate :: { AttributeParser , EmitAttribute } ;
70- use crate :: context:: private:: Sealed ;
7169
7270type GroupType = LazyLock < GroupTypeInner > ;
7371
@@ -91,20 +89,6 @@ pub(crate) type FinalizeFn =
9189macro_rules! attribute_parsers {
9290 (
9391 pub ( crate ) static $name: ident = [ $( $names: ty) ,* $( , ) ?] ;
94- ) => {
95- mod early {
96- use super :: * ;
97-
98- attribute_parsers!( @[ Early ] pub ( crate ) static $name = [ $( $names) ,* ] ; ) ;
99- }
100- mod late {
101- use super :: * ;
102-
103- attribute_parsers!( @[ Late ] pub ( crate ) static $name = [ $( $names) ,* ] ; ) ;
104- }
105- } ;
106- (
107- @[ $stage: ty] pub ( crate ) static $name: ident = [ $( $names: ty) ,* $( , ) ?] ;
10892 ) => {
10993 pub ( crate ) static $name: GroupType = LazyLock :: new( || {
11094 let mut accepters = BTreeMap :: <_, GroupTypeInnerAccept >:: new( ) ;
@@ -339,46 +323,6 @@ attribute_parsers!(
339323 ] ;
340324) ;
341325
342- mod private {
343- pub trait Sealed { }
344- impl Sealed for super :: Early { }
345- impl Sealed for super :: Late { }
346- }
347-
348- // allow because it's a sealed trait
349- #[ allow( private_interfaces) ]
350- pub trait Stage : Sized + ' static + Sealed {
351- type Id : Copy ;
352-
353- fn parsers ( ) -> & ' static GroupType ;
354- }
355-
356- // allow because it's a sealed trait
357- #[ allow( private_interfaces) ]
358- impl Stage for Early {
359- type Id = NodeId ;
360-
361- fn parsers ( ) -> & ' static GroupType {
362- & early:: ATTRIBUTE_PARSERS
363- }
364- }
365-
366- // allow because it's a sealed trait
367- #[ allow( private_interfaces) ]
368- impl Stage for Late {
369- type Id = HirId ;
370-
371- fn parsers ( ) -> & ' static GroupType {
372- & late:: ATTRIBUTE_PARSERS
373- }
374- }
375-
376- /// Used when parsing attributes for miscellaneous things *before* ast lowering
377- pub struct Early ;
378-
379- /// used when parsing attributes during ast lowering
380- pub struct Late ;
381-
382326/// Context given to every attribute parser when accepting
383327///
384328/// Gives [`AttributeParser`]s enough information to create errors, for example.
0 commit comments