File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff 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 > > {
Original file line number Diff line number Diff line change @@ -10,11 +10,9 @@ use crate::ty::query::Providers;
1010use crate :: ty:: TyCtxt ;
1111use rustc_data_structures:: cold_path;
1212use rustc_data_structures:: fx:: FxHashMap ;
13- use rustc_hir:: def_id:: DefId ;
1413use rustc_hir:: def_id:: LOCAL_CRATE ;
1514use rustc_hir:: print;
1615use rustc_hir:: Body ;
17- use rustc_hir:: BodyId ;
1816use rustc_hir:: Crate ;
1917use rustc_hir:: HirId ;
2018use 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
6555impl < ' tcx > Deref for Hir < ' tcx > {
You can’t perform that action at this time.
0 commit comments