File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 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 {
226226 /// but cannot supply a `Map`; see `nested_visit_map` for advice.
227227 #[ allow( unused_variables) ]
228228 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 ) ) ;
230230 if let Some ( item) = opt_item {
231231 self . visit_item ( item) ;
232232 }
Original file line number Diff line number Diff line change @@ -405,6 +405,14 @@ impl<'hir> Map<'hir> {
405405 self . forest . krate ( )
406406 }
407407
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+
408416 pub fn trait_item ( & self , id : TraitItemId ) -> & ' hir TraitItem < ' hir > {
409417 self . read ( id. hir_id ) ;
410418
You can’t perform that action at this time.
0 commit comments