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