Skip to content

Commit 6b93fcb

Browse files
authored
Merge pull request #4044 from RalfJung/rustup
Rustup
2 parents 3018386 + 2be3897 commit 6b93fcb

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
875df370be806c837f58abb638329905e969ace4
1+
2d0ea7956c45de6e421fd579e2ded27be405dec6

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl NewPermission {
7171
access: None,
7272
protector: None,
7373
}
74-
} else if pointee.is_unpin(*cx.tcx, cx.param_env()) {
74+
} else if pointee.is_unpin(*cx.tcx, cx.typing_env()) {
7575
// A regular full mutable reference. On `FnEntry` this is `noalias` and `dereferenceable`.
7676
NewPermission::Uniform {
7777
perm: Permission::Unique,
@@ -129,7 +129,7 @@ impl NewPermission {
129129
fn from_box_ty<'tcx>(ty: Ty<'tcx>, kind: RetagKind, cx: &crate::MiriInterpCx<'tcx>) -> Self {
130130
// `ty` is not the `Box` but the field of the Box with this pointer (due to allocator handling).
131131
let pointee = ty.builtin_deref(true).unwrap();
132-
if pointee.is_unpin(*cx.tcx, cx.param_env()) {
132+
if pointee.is_unpin(*cx.tcx, cx.typing_env()) {
133133
// A regular box. On `FnEntry` this is `noalias`, but not `dereferenceable` (hence only
134134
// a weak protector).
135135
NewPermission::Uniform {
@@ -608,7 +608,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
608608
match new_perm {
609609
NewPermission::Uniform { perm, .. } =>
610610
write!(kind_str, "{perm:?} permission").unwrap(),
611-
NewPermission::FreezeSensitive { freeze_perm, .. } if ty.is_freeze(*this.tcx, this.param_env()) =>
611+
NewPermission::FreezeSensitive { freeze_perm, .. } if ty.is_freeze(*this.tcx, this.typing_env()) =>
612612
write!(kind_str, "{freeze_perm:?} permission").unwrap(),
613613
NewPermission::FreezeSensitive { freeze_perm, nonfreeze_perm, .. } =>
614614
write!(kind_str, "{freeze_perm:?}/{nonfreeze_perm:?} permission for frozen/non-frozen parts").unwrap(),

src/borrow_tracker/tree_borrows/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ impl<'tcx> NewPermission {
132132
kind: RetagKind,
133133
cx: &crate::MiriInterpCx<'tcx>,
134134
) -> Option<Self> {
135-
let ty_is_freeze = pointee.is_freeze(*cx.tcx, cx.param_env());
136-
let ty_is_unpin = pointee.is_unpin(*cx.tcx, cx.param_env());
135+
let ty_is_freeze = pointee.is_freeze(*cx.tcx, cx.typing_env());
136+
let ty_is_unpin = pointee.is_unpin(*cx.tcx, cx.typing_env());
137137
let is_protected = kind == RetagKind::FnEntry;
138138
// As demonstrated by `tests/fail/tree_borrows/reservedim_spurious_write.rs`,
139139
// interior mutability and protectors interact poorly.
@@ -164,10 +164,10 @@ impl<'tcx> NewPermission {
164164
zero_size: bool,
165165
) -> Option<Self> {
166166
let pointee = ty.builtin_deref(true).unwrap();
167-
pointee.is_unpin(*cx.tcx, cx.param_env()).then_some(()).map(|()| {
167+
pointee.is_unpin(*cx.tcx, cx.typing_env()).then_some(()).map(|()| {
168168
// Regular `Unpin` box, give it `noalias` but only a weak protector
169169
// because it is valid to deallocate it within the function.
170-
let ty_is_freeze = ty.is_freeze(*cx.tcx, cx.param_env());
170+
let ty_is_freeze = ty.is_freeze(*cx.tcx, cx.typing_env());
171171
let protected = kind == RetagKind::FnEntry;
172172
let initial_state = Permission::new_reserved(ty_is_freeze, protected);
173173
Self {
@@ -521,7 +521,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
521521
// Note: if we were to inline `new_reserved` below we would find out that
522522
// `ty_is_freeze` is eventually unused because it appears in a `ty_is_freeze || true`.
523523
// We are nevertheless including it here for clarity.
524-
let ty_is_freeze = place.layout.ty.is_freeze(*this.tcx, this.param_env());
524+
let ty_is_freeze = place.layout.ty.is_freeze(*this.tcx, this.typing_env());
525525
// Retag it. With protection! That is the entire point.
526526
let new_perm = NewPermission {
527527
initial_state: Permission::new_reserved(ty_is_freeze, /* protected */ true),

src/eval.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,8 @@ pub fn create_ecx<'tcx>(
270270
) -> InterpResult<'tcx, InterpCx<'tcx, MiriMachine<'tcx>>> {
271271
let typing_env = ty::TypingEnv::fully_monomorphized();
272272
let layout_cx = LayoutCx::new(tcx, typing_env);
273-
let mut ecx = InterpCx::new(
274-
tcx,
275-
rustc_span::DUMMY_SP,
276-
typing_env.param_env,
277-
MiriMachine::new(config, layout_cx),
278-
);
273+
let mut ecx =
274+
InterpCx::new(tcx, rustc_span::DUMMY_SP, typing_env, MiriMachine::new(config, layout_cx));
279275

280276
// Some parts of initialization require a full `InterpCx`.
281277
MiriMachine::late_init(&mut ecx, config, {

src/machine.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1717
use rustc_data_structures::static_assert_size;
1818
use rustc_middle::mir;
1919
use rustc_middle::query::TyCtxtAt;
20-
use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, LayoutError, LayoutOf, TyAndLayout};
20+
use rustc_middle::ty::layout::{
21+
HasTyCtxt, HasTypingEnv, LayoutCx, LayoutError, LayoutOf, TyAndLayout,
22+
};
2123
use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
2224
use rustc_session::config::InliningThreshold;
2325
use rustc_span::def_id::{CrateNum, DefId};

0 commit comments

Comments
 (0)