]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_borrowck/src/universal_regions.rs
Avoid accessing HIR from MIR queries.
[rust.git] / compiler / rustc_borrowck / src / universal_regions.rs
index e9c64049817f5558e16d7a7510e57a0120a690aa..28a566ca40861cc32fb722d24055b3c61d21cafe 100644 (file)
@@ -524,7 +524,7 @@ fn defining_ty(&self) -> DefiningTy<'tcx> {
         let tcx = self.infcx.tcx;
         let typeck_root_def_id = tcx.typeck_root_def_id(self.mir_def.did.to_def_id());
 
-        match tcx.hir().body_owner_kind(self.mir_hir_id) {
+        match tcx.hir().body_owner_kind(self.mir_def.did) {
             BodyOwnerKind::Closure | BodyOwnerKind::Fn => {
                 let defining_ty = if self.mir_def.did.to_def_id() == typeck_root_def_id {
                     tcx.type_of(typeck_root_def_id)
@@ -829,12 +829,12 @@ fn for_each_late_bound_region_defined_on<'tcx>(
 ) {
     if let Some((owner, late_bounds)) = tcx.is_late_bound_map(fn_def_id.expect_local()) {
         for &late_bound in late_bounds.iter() {
-            let hir_id = HirId { owner, local_id: late_bound };
-            let name = tcx.hir().name(hir_id);
-            let region_def_id = tcx.hir().local_def_id(hir_id);
+            let region_def_id =
+                tcx.hir().local_def_id(HirId { owner, local_id: late_bound }).to_def_id();
+            let name = tcx.item_name(region_def_id);
             let liberated_region = tcx.mk_region(ty::ReFree(ty::FreeRegion {
                 scope: owner.to_def_id(),
-                bound_region: ty::BoundRegionKind::BrNamed(region_def_id.to_def_id(), name),
+                bound_region: ty::BoundRegionKind::BrNamed(region_def_id, name),
             }));
             f(liberated_region);
         }