11use rustc_abi:: ExternAbi ;
22use rustc_ast:: visit:: AssocCtxt ;
33use rustc_ast:: * ;
4+ use rustc_attr_ir:: target:: Target ;
5+ use rustc_attr_ir:: { AttributeKind , EiiImplResolution , find_attr} ;
46use rustc_errors:: { E0570 , ErrorGuaranteed , struct_span_code_err} ;
5- use rustc_hir:: attrs:: { AttributeKind , EiiImplResolution } ;
67use rustc_hir:: def:: { DefKind , PerNS , Res } ;
7- use rustc_hir:: {
8- self as hir, HirId , ImplItemImplKind , LifetimeSource , PredicateOrigin , Target , find_attr,
9- } ;
8+ use rustc_hir:: { self as hir, HirId , ImplItemImplKind , LifetimeSource , PredicateOrigin } ;
109use rustc_middle:: ty:: data_structures:: IndexMap ;
1110use rustc_span:: def_id:: { DefId , LocalDefId } ;
1211use rustc_span:: edit_distance:: find_best_match_for_name;
@@ -68,8 +67,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
6867 id : NodeId ,
6968 name : Ident ,
7069 EiiDecl { foreign_item, impl_unsafe } : & EiiDecl ,
71- ) -> Option < hir :: attrs :: EiiDecl > {
72- self . lower_path_simple_eii ( id, foreign_item) . map ( |did| hir :: attrs :: EiiDecl {
70+ ) -> Option < rustc_attr_ir :: EiiDecl > {
71+ self . lower_path_simple_eii ( id, foreign_item) . map ( |did| rustc_attr_ir :: EiiDecl {
7372 foreign_item : did,
7473 impl_unsafe : * impl_unsafe,
7574 name,
@@ -87,7 +86,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
8786 is_default,
8887 known_eii_macro_resolution,
8988 } : & EiiImpl ,
90- ) -> hir :: attrs :: EiiImpl {
89+ ) -> rustc_attr_ir :: EiiImpl {
9190 let resolution = if let Some ( target) = known_eii_macro_resolution
9291 && let Some ( foreign_item_did) = self . lower_path_simple_eii ( * node_id, target)
9392 {
@@ -100,7 +99,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
10099 )
101100 } ;
102101
103- hir :: attrs :: EiiImpl {
102+ rustc_attr_ir :: EiiImpl {
104103 span : self . lower_span ( * span) ,
105104 inner_span : self . lower_span ( * inner_span) ,
106105 impl_unsafe_span : match * impl_safety {
@@ -116,19 +115,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
116115 & mut self ,
117116 id : NodeId ,
118117 i : & ItemKind ,
119- ) -> Vec < hir :: Attribute > {
118+ ) -> Vec < rustc_attr_ir :: Attribute > {
120119 match i {
121120 ItemKind :: Fn ( Fn { eii_impl : None , .. } )
122121 | ItemKind :: Static ( StaticItem { eii_impl : None , .. } ) => Vec :: new ( ) ,
123122 ItemKind :: Fn ( Fn { eii_impl : Some ( eii_impl) , .. } )
124123 | ItemKind :: Static ( StaticItem { eii_impl : Some ( eii_impl) , .. } ) => {
125- vec ! [ hir :: Attribute :: Parsed ( AttributeKind :: EiiImpl ( Box :: new(
124+ vec ! [ rustc_attr_ir :: Attribute :: Parsed ( AttributeKind :: EiiImpl ( Box :: new(
126125 self . lower_eii_impl( eii_impl) ,
127126 ) ) ) ]
128127 }
129128 ItemKind :: MacroDef ( name, MacroDef { eii_declaration : Some ( target) , .. } ) => self
130129 . lower_eii_decl ( id, * name, target)
131- . map ( |decl| vec ! [ hir:: Attribute :: Parsed ( AttributeKind :: EiiDeclaration ( decl) ) ] )
130+ . map ( |decl| {
131+ vec ! [ rustc_attr_ir:: Attribute :: Parsed ( AttributeKind :: EiiDeclaration ( decl) ) ]
132+ } )
132133 . unwrap_or_default ( ) ,
133134
134135 ItemKind :: ExternCrate ( ..)
@@ -184,7 +185,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
184185 span : Span ,
185186 id : NodeId ,
186187 hir_id : hir:: HirId ,
187- attrs : & ' hir [ hir :: Attribute ] ,
188+ attrs : & ' hir [ rustc_attr_ir :: Attribute ] ,
188189 vis_span : Span ,
189190 i : & ItemKind ,
190191 ) -> hir:: ItemKind < ' hir > {
@@ -551,7 +552,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
551552 prefix : & Path ,
552553 id : NodeId ,
553554 vis_span : Span ,
554- attrs : & ' hir [ hir :: Attribute ] ,
555+ attrs : & ' hir [ rustc_attr_ir :: Attribute ] ,
555556 ) -> hir:: ItemKind < ' hir > {
556557 let path = & tree. prefix ;
557558 let segments = prefix. segments . iter ( ) . chain ( path. segments . iter ( ) ) . cloned ( ) . collect ( ) ;
@@ -1351,7 +1352,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
13511352 decl : & FnDecl ,
13521353 coroutine_marker : Option < CoroutineMarker > ,
13531354 body : Option < & Block > ,
1354- attrs : & ' hir [ hir :: Attribute ] ,
1355+ attrs : & ' hir [ rustc_attr_ir :: Attribute ] ,
13551356 contract : Option < & FnContract > ,
13561357 ) -> hir:: BodyId {
13571358 let Some ( body) = body else {
@@ -1612,7 +1613,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
16121613 id : NodeId ,
16131614 kind : FnDeclKind ,
16141615 coroutine_marker : Option < CoroutineMarker > ,
1615- attrs : & [ hir :: Attribute ] ,
1616+ attrs : & [ rustc_attr_ir :: Attribute ] ,
16161617 ) -> ( & ' hir hir:: Generics < ' hir > , hir:: FnSig < ' hir > ) {
16171618 let header = self . lower_fn_header ( sig. header , hir:: Safety :: Safe , attrs) ;
16181619 let itctx = ImplTraitContext :: Universal ;
@@ -1626,7 +1627,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
16261627 & mut self ,
16271628 h : FnHeader ,
16281629 default_safety : hir:: Safety ,
1629- attrs : & [ hir :: Attribute ] ,
1630+ attrs : & [ rustc_attr_ir :: Attribute ] ,
16301631 ) -> hir:: FnHeader {
16311632 let asyncness = if let Some ( coroutine_marker) = h. coroutine_marker
16321633 && let CoroutineKind :: Async = coroutine_marker. kind
@@ -1713,7 +1714,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
17131714 /// Lowers constness or comptime attribute.
17141715 /// Whether `const` is allowed here is checked by ast validation.
17151716 /// Whether `comptime` is allowed here is checked by the `comptime` attribute parser.
1716- pub ( super ) fn lower_constness ( & mut self , attrs : & [ hir:: Attribute ] , c : Const ) -> hir:: Constness {
1717+ pub ( super ) fn lower_constness (
1718+ & mut self ,
1719+ attrs : & [ rustc_attr_ir:: Attribute ] ,
1720+ c : Const ,
1721+ ) -> hir:: Constness {
17171722 let mut constness = match c {
17181723 Const :: Yes ( _) => hir:: Constness :: Const { always : false } ,
17191724 Const :: No => hir:: Constness :: NotConst ,
0 commit comments