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> {
433
433
}
434
434
435
435
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 ( )
441
441
}
442
442
443
443
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;
10
10
use crate :: ty:: TyCtxt ;
11
11
use rustc_data_structures:: cold_path;
12
12
use rustc_data_structures:: fx:: FxHashMap ;
13
- use rustc_hir:: def_id:: DefId ;
14
13
use rustc_hir:: def_id:: LOCAL_CRATE ;
15
14
use rustc_hir:: print;
16
15
use rustc_hir:: Body ;
17
- use rustc_hir:: BodyId ;
18
16
use rustc_hir:: Crate ;
19
17
use rustc_hir:: HirId ;
20
18
use rustc_hir:: ItemLocalId ;
@@ -52,14 +50,6 @@ impl<'tcx> Hir<'tcx> {
52
50
pub fn krate ( & self ) -> & ' tcx Crate < ' tcx > {
53
51
self . tcx . hir_crate ( LOCAL_CRATE )
54
52
}
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
- }
63
53
}
64
54
65
55
impl < ' tcx > Deref for Hir < ' tcx > {
You can’t perform that action at this time.
0 commit comments