Skip to content

Commit 62e9ccb

Browse files
committed
intravisit: .expect_item -> .item
1 parent 4b08c7e commit 62e9ccb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

src/librustc/hir/map/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)