Skip to content

Commit 577e0b6

Browse files
committed
Merge from rustc
2 parents e149cee + 3a54c6d commit 577e0b6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_data_structures::fx::FxHashSet;
1515
use rustc_middle::mir::{Mutability, RetagKind};
1616
use rustc_middle::ty::{
1717
self,
18-
layout::{HasParamEnv, LayoutOf},
18+
layout::HasParamEnv,
1919
Ty,
2020
};
2121
use rustc_target::abi::{Abi, Align, Size};
@@ -993,8 +993,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
993993

994994
// We have to turn the place into a pointer to use the usual retagging logic.
995995
// (The pointer type does not matter, so we use a raw pointer.)
996-
let ptr_layout = this.layout_of(Ty::new_mut_ptr(this.tcx.tcx, place.layout.ty))?;
997-
let ptr = ImmTy::from_immediate(place.to_ref(this), ptr_layout);
996+
let ptr = this.mplace_to_ref(place)?;
998997
// Reborrow it. With protection! That is the entire point.
999998
let new_perm = NewPermission::Uniform {
1000999
perm: Permission::Unique,

src/borrow_tracker/tree_borrows/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_middle::{
77
mir::{Mutability, RetagKind},
88
ty::{
99
self,
10-
layout::{HasParamEnv, LayoutOf},
10+
layout::HasParamEnv,
1111
Ty,
1212
},
1313
};
@@ -493,8 +493,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
493493

494494
// We have to turn the place into a pointer to use the usual retagging logic.
495495
// (The pointer type does not matter, so we use a raw pointer.)
496-
let ptr_layout = this.layout_of(Ty::new_mut_ptr(this.tcx.tcx, place.layout.ty))?;
497-
let ptr = ImmTy::from_immediate(place.to_ref(this), ptr_layout);
496+
let ptr = this.mplace_to_ref(place)?;
498497
// Reborrow it. With protection! That is the entire point.
499498
let new_perm = NewPermission {
500499
initial_state: Permission::new_active(),

0 commit comments

Comments
 (0)