@@ -158,7 +158,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
158
158
vec ! [ hir:: Attribute :: Parsed ( AttributeKind :: EiiImpl (
159
159
eii_impl
160
160
. iter( )
161
- . map (
161
+ . flat_map (
162
162
|EIIImpl {
163
163
node_id,
164
164
eii_macro_path,
@@ -167,16 +167,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
167
167
inner_span,
168
168
is_default,
169
169
} | {
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
+ } )
180
181
} ,
181
182
)
182
183
. collect( ) ,
@@ -188,13 +189,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
188
189
eii_macro_for : Some ( EIIMacroFor { extern_item_path, impl_unsafe, span } ) ,
189
190
..
190
191
} ,
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 ( ) ,
198
202
ItemKind :: ExternCrate ( ..)
199
203
| ItemKind :: Use ( ..)
200
204
| ItemKind :: Static ( ..)
@@ -571,14 +575,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
571
575
}
572
576
}
573
577
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 > {
575
579
let res = self . resolver . get_partial_res ( id) . unwrap ( ) ;
576
580
let Some ( did) = res. expect_full_res ( ) . opt_def_id ( ) else {
577
581
self . dcx ( ) . span_delayed_bug ( path. span , "should have errored in resolve" ) ;
578
- todo ! ( )
582
+ return None ;
579
583
} ;
580
584
581
- did
585
+ Some ( did)
582
586
}
583
587
584
588
fn lower_const_item (
0 commit comments