File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ pub trait Visitor<'v>: Sized {
226
226
/// but cannot supply a `Map`; see `nested_visit_map` for advice.
227
227
#[ allow( unused_variables) ]
228
228
fn visit_nested_item ( & mut self , id : ItemId ) {
229
- let opt_item = self . nested_visit_map ( ) . inter ( ) . map ( |map| map. expect_item ( id. id ) ) ;
229
+ let opt_item = self . nested_visit_map ( ) . inter ( ) . map ( |map| map. item ( id. id ) ) ;
230
230
if let Some ( item) = opt_item {
231
231
self . visit_item ( item) ;
232
232
}
Original file line number Diff line number Diff line change @@ -405,6 +405,14 @@ impl<'hir> Map<'hir> {
405
405
self . forest . krate ( )
406
406
}
407
407
408
+ pub fn item ( & self , id : HirId ) -> & ' hir Item < ' hir > {
409
+ self . read ( id) ;
410
+
411
+ // N.B., intentionally bypass `self.forest.krate()` so that we
412
+ // do not trigger a read of the whole krate here
413
+ self . forest . krate . item ( id)
414
+ }
415
+
408
416
pub fn trait_item ( & self , id : TraitItemId ) -> & ' hir TraitItem < ' hir > {
409
417
self . read ( id. hir_id ) ;
410
418
You can’t perform that action at this time.
0 commit comments