|
1 | 1 | use rustc_abi::{BackendRepr, Size}; |
2 | 2 | use rustc_middle::mir::{Mutability, RetagKind}; |
3 | | -use rustc_middle::ty::layout::HasTypingEnv; |
4 | 3 | use rustc_middle::ty::{self, Ty}; |
5 | 4 | use rustc_span::def_id::DefId; |
6 | 5 |
|
@@ -132,8 +131,8 @@ impl<'tcx> NewPermission { |
132 | 131 | kind: RetagKind, |
133 | 132 | cx: &crate::MiriInterpCx<'tcx>, |
134 | 133 | ) -> 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()); |
| 134 | + let ty_is_freeze = pointee.is_freeze(*cx.tcx, cx.typing_env); |
| 135 | + let ty_is_unpin = pointee.is_unpin(*cx.tcx, cx.typing_env); |
137 | 136 | let is_protected = kind == RetagKind::FnEntry; |
138 | 137 | // As demonstrated by `tests/fail/tree_borrows/reservedim_spurious_write.rs`, |
139 | 138 | // interior mutability and protectors interact poorly. |
@@ -164,10 +163,10 @@ impl<'tcx> NewPermission { |
164 | 163 | zero_size: bool, |
165 | 164 | ) -> Option<Self> { |
166 | 165 | let pointee = ty.builtin_deref(true).unwrap(); |
167 | | - pointee.is_unpin(*cx.tcx, cx.param_env()).then_some(()).map(|()| { |
| 166 | + pointee.is_unpin(*cx.tcx, cx.typing_env).then_some(()).map(|()| { |
168 | 167 | // Regular `Unpin` box, give it `noalias` but only a weak protector |
169 | 168 | // because it is valid to deallocate it within the function. |
170 | | - let ty_is_freeze = ty.is_freeze(*cx.tcx, cx.param_env()); |
| 169 | + let ty_is_freeze = ty.is_freeze(*cx.tcx, cx.typing_env); |
171 | 170 | let protected = kind == RetagKind::FnEntry; |
172 | 171 | let initial_state = Permission::new_reserved(ty_is_freeze, protected); |
173 | 172 | Self { |
@@ -521,7 +520,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { |
521 | 520 | // Note: if we were to inline `new_reserved` below we would find out that |
522 | 521 | // `ty_is_freeze` is eventually unused because it appears in a `ty_is_freeze || true`. |
523 | 522 | // We are nevertheless including it here for clarity. |
524 | | - let ty_is_freeze = place.layout.ty.is_freeze(*this.tcx, this.param_env()); |
| 523 | + let ty_is_freeze = place.layout.ty.is_freeze(*this.tcx, this.typing_env); |
525 | 524 | // Retag it. With protection! That is the entire point. |
526 | 525 | let new_perm = NewPermission { |
527 | 526 | initial_state: Permission::new_reserved(ty_is_freeze, /* protected */ true), |
|
0 commit comments