Skip to content

Commit b091d26

Browse files
committed
Move body back
1 parent 38a7d04 commit b091d26

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,11 @@ impl<'hir> Map<'hir> {
433433
}
434434

435435
pub fn body(&self, id: BodyId) -> &'hir Body<'hir> {
436-
self.read(id.hir_id);
437-
438-
// N.B., intentionally bypass `self.krate()` so that we
439-
// do not trigger a read of the whole krate here
440-
self.krate.body(id)
436+
self.tcx
437+
.hir_owner_items(DefId::local(id.hir_id.owner))
438+
.bodies
439+
.get(&id.hir_id.local_id)
440+
.unwrap()
441441
}
442442

443443
pub fn fn_decl_by_hir_id(&self, hir_id: HirId) -> Option<&'hir FnDecl<'hir>> {

src/librustc/hir/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ use crate::ty::query::Providers;
1010
use crate::ty::TyCtxt;
1111
use rustc_data_structures::cold_path;
1212
use rustc_data_structures::fx::FxHashMap;
13-
use rustc_hir::def_id::DefId;
1413
use rustc_hir::def_id::LOCAL_CRATE;
1514
use rustc_hir::print;
1615
use rustc_hir::Body;
17-
use rustc_hir::BodyId;
1816
use rustc_hir::Crate;
1917
use rustc_hir::HirId;
2018
use rustc_hir::ItemLocalId;
@@ -52,14 +50,6 @@ impl<'tcx> Hir<'tcx> {
5250
pub fn krate(&self) -> &'tcx Crate<'tcx> {
5351
self.tcx.hir_crate(LOCAL_CRATE)
5452
}
55-
56-
pub fn body(&self, id: BodyId) -> &'tcx Body<'tcx> {
57-
self.tcx
58-
.hir_owner_items(DefId::local(id.hir_id.owner))
59-
.bodies
60-
.get(&id.hir_id.local_id)
61-
.unwrap()
62-
}
6353
}
6454

6555
impl<'tcx> Deref for Hir<'tcx> {

0 commit comments

Comments
 (0)