@@ -2,7 +2,7 @@ use rustc_abi::ExternAbi;
22use rustc_ast:: visit:: AssocCtxt ;
33use rustc_ast:: * ;
44use rustc_errors:: { E0570 , ErrorGuaranteed , struct_span_code_err} ;
5- use rustc_hir:: attrs:: { AttributeKind , EiiDecl , EiiImplResolution } ;
5+ use rustc_hir:: attrs:: { AttributeKind , EiiImplResolution } ;
66use rustc_hir:: def:: { DefKind , PerNS , Res } ;
77use rustc_hir:: def_id:: { CRATE_DEF_ID , LocalDefId } ;
88use rustc_hir:: {
@@ -134,16 +134,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
134134 }
135135 }
136136
137- fn lower_eii_extern_target (
137+ fn lower_eii_decl (
138138 & mut self ,
139139 id : NodeId ,
140- eii_name : Ident ,
141- EiiExternTarget { extern_item_path , impl_unsafe } : & EiiExternTarget ,
142- ) -> Option < EiiDecl > {
143- self . lower_path_simple_eii ( id, extern_item_path ) . map ( |did| EiiDecl {
144- eii_extern_target : did,
140+ name : Ident ,
141+ EiiDecl { foreign_item , impl_unsafe } : & EiiDecl ,
142+ ) -> Option < hir :: attrs :: EiiDecl > {
143+ self . lower_path_simple_eii ( id, foreign_item ) . map ( |did| hir :: attrs :: EiiDecl {
144+ foreign_item : did,
145145 impl_unsafe : * impl_unsafe,
146- name : eii_name ,
146+ name,
147147 } )
148148 }
149149
@@ -160,7 +160,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
160160 } : & EiiImpl ,
161161 ) -> hir:: attrs:: EiiImpl {
162162 let resolution = if let Some ( target) = known_eii_macro_resolution
163- && let Some ( decl) = self . lower_eii_extern_target (
163+ && let Some ( decl) = self . lower_eii_decl (
164164 * node_id,
165165 // the expect is ok here since we always generate this path in the eii macro.
166166 eii_macro_path. segments . last ( ) . expect ( "at least one segment" ) . ident ,
@@ -196,9 +196,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
196196 eii_impls. iter( ) . map( |i| self . lower_eii_impl( i) ) . collect( ) ,
197197 ) ) ]
198198 }
199- ItemKind :: MacroDef ( name, MacroDef { eii_extern_target : Some ( target) , .. } ) => self
200- . lower_eii_extern_target ( id, * name, target)
201- . map ( |decl| vec ! [ hir:: Attribute :: Parsed ( AttributeKind :: EiiExternTarget ( decl) ) ] )
199+ ItemKind :: MacroDef ( name, MacroDef { eii_declaration : Some ( target) , .. } ) => self
200+ . lower_eii_decl ( id, * name, target)
201+ . map ( |decl| vec ! [ hir:: Attribute :: Parsed ( AttributeKind :: EiiDeclaration ( decl) ) ] )
202202 . unwrap_or_default ( ) ,
203203
204204 ItemKind :: ExternCrate ( ..)
@@ -242,10 +242,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
242242 vis_span,
243243 span : self . lower_span ( i. span ) ,
244244 has_delayed_lints : !self . delayed_lints . is_empty ( ) ,
245- eii : find_attr ! (
246- attrs,
247- AttributeKind :: EiiImpls ( ..) | AttributeKind :: EiiExternTarget ( ..)
248- ) ,
245+ eii : find_attr ! ( attrs, AttributeKind :: EiiImpls ( ..) | AttributeKind :: EiiDeclaration ( ..) ) ,
249246 } ;
250247 self . arena . alloc ( item)
251248 }
@@ -539,7 +536,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
539536 ) ;
540537 hir:: ItemKind :: TraitAlias ( constness, ident, generics, bounds)
541538 }
542- ItemKind :: MacroDef ( ident, MacroDef { body, macro_rules, eii_extern_target : _ } ) => {
539+ ItemKind :: MacroDef ( ident, MacroDef { body, macro_rules, eii_declaration : _ } ) => {
543540 let ident = self . lower_ident ( * ident) ;
544541 let body = Box :: new ( self . lower_delim_args ( body) ) ;
545542 let def_id = self . local_def_id ( id) ;
@@ -553,7 +550,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
553550 let macro_def = self . arena . alloc ( ast:: MacroDef {
554551 body,
555552 macro_rules : * macro_rules,
556- eii_extern_target : None ,
553+ eii_declaration : None ,
557554 } ) ;
558555 hir:: ItemKind :: Macro ( ident, macro_def, macro_kinds)
559556 }
@@ -693,7 +690,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
693690 has_delayed_lints : !this. delayed_lints . is_empty ( ) ,
694691 eii : find_attr ! (
695692 attrs,
696- AttributeKind :: EiiImpls ( ..) | AttributeKind :: EiiExternTarget ( ..)
693+ AttributeKind :: EiiImpls ( ..) | AttributeKind :: EiiDeclaration ( ..)
697694 ) ,
698695 } ;
699696 hir:: OwnerNode :: Item ( this. arena . alloc ( item) )
0 commit comments