@@ -158,7 +158,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
158158 vec ! [ hir:: Attribute :: Parsed ( AttributeKind :: EiiImpl (
159159 eii_impl
160160 . iter( )
161- . map (
161+ . flat_map (
162162 |EIIImpl {
163163 node_id,
164164 eii_macro_path,
@@ -167,16 +167,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
167167 inner_span,
168168 is_default,
169169 } | {
170- let did = self . lower_path_simple_eii( * node_id, eii_macro_path) ;
171- rustc_attr_parsing:: EIIImpl {
172- eii_macro: did,
173- span: self . lower_span( * span) ,
174- inner_span: self . lower_span( * inner_span) ,
175- impl_marked_unsafe: self
176- . lower_safety( * impl_safety, hir:: Safety :: Safe )
177- . is_unsafe( ) ,
178- is_default: * is_default,
179- }
170+ self . lower_path_simple_eii( * node_id, eii_macro_path) . map( |did| {
171+ rustc_attr_parsing:: EIIImpl {
172+ eii_macro: did,
173+ span: self . lower_span( * span) ,
174+ inner_span: self . lower_span( * inner_span) ,
175+ impl_marked_unsafe: self
176+ . lower_safety( * impl_safety, hir:: Safety :: Safe )
177+ . is_unsafe( ) ,
178+ is_default: * is_default,
179+ }
180+ } )
180181 } ,
181182 )
182183 . collect( ) ,
@@ -188,13 +189,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
188189 eii_macro_for : Some ( EIIMacroFor { extern_item_path, impl_unsafe, span } ) ,
189190 ..
190191 } ,
191- ) => {
192- vec ! [ hir:: Attribute :: Parsed ( AttributeKind :: EiiMacroFor ( EIIDecl {
193- eii_extern_item: self . lower_path_simple_eii( id, extern_item_path) ,
194- impl_unsafe: * impl_unsafe,
195- span: self . lower_span( * span) ,
196- } ) ) ]
197- }
192+ ) => self
193+ . lower_path_simple_eii ( id, extern_item_path)
194+ . map ( |did| {
195+ vec ! [ hir:: Attribute :: Parsed ( AttributeKind :: EiiMacroFor ( EIIDecl {
196+ eii_extern_item: did,
197+ impl_unsafe: * impl_unsafe,
198+ span: self . lower_span( * span) ,
199+ } ) ) ]
200+ } )
201+ . unwrap_or_default ( ) ,
198202 ItemKind :: ExternCrate ( ..)
199203 | ItemKind :: Use ( ..)
200204 | ItemKind :: Static ( ..)
@@ -571,14 +575,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
571575 }
572576 }
573577
574- fn lower_path_simple_eii ( & mut self , id : NodeId , path : & Path ) -> DefId {
578+ fn lower_path_simple_eii ( & mut self , id : NodeId , path : & Path ) -> Option < DefId > {
575579 let res = self . resolver . get_partial_res ( id) . unwrap ( ) ;
576580 let Some ( did) = res. expect_full_res ( ) . opt_def_id ( ) else {
577581 self . dcx ( ) . span_delayed_bug ( path. span , "should have errored in resolve" ) ;
578- todo ! ( )
582+ return None ;
579583 } ;
580584
581- did
585+ Some ( did)
582586 }
583587
584588 fn lower_const_item (
0 commit comments