Skip to content

Commit 460b7d7

Browse files
committed
Auto merge of #122852 - compiler-errors:raw-ptr, r=lcnr
Remove `TypeAndMut` from `ty::RawPtr` variant, make it take `Ty` and `Mutability` Pretty much mechanically converting `ty::RawPtr(ty::TypeAndMut { ty, mutbl })` to `ty::RawPtr(ty, mutbl)` and its fallout. r? lcnr cc rust-lang/types-team#124
2 parents 920b37f + a048b16 commit 460b7d7

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/borrow_tracker/stacked_borrows/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl NewPermission {
9090
}
9191
}
9292
}
93-
ty::RawPtr(ty::TypeAndMut { mutbl: Mutability::Mut, .. }) => {
93+
ty::RawPtr(_, Mutability::Mut) => {
9494
assert!(protector.is_none()); // RetagKind can't be both FnEntry and Raw.
9595
// Mutable raw pointer. No access, not protected.
9696
NewPermission::Uniform {
@@ -114,7 +114,7 @@ impl NewPermission {
114114
// This fixes https://github.com/rust-lang/rust/issues/55005.
115115
}
116116
}
117-
ty::RawPtr(ty::TypeAndMut { mutbl: Mutability::Not, .. }) => {
117+
ty::RawPtr(_, Mutability::Not) => {
118118
assert!(protector.is_none()); // RetagKind can't be both FnEntry and Raw.
119119
// `*const T`, when freshly created, are read-only in the frozen part.
120120
NewPermission::FreezeSensitive {

src/borrow_tracker/tree_borrows/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
475475
NewPermission::from_ref_ty(pointee, mutability, self.kind, self.ecx);
476476
self.retag_ptr_inplace(place, new_perm)?;
477477
}
478-
ty::RawPtr(_) => {
478+
ty::RawPtr(_, _) => {
479479
// We definitely do *not* want to recurse into raw pointers -- wide raw
480480
// pointers have fields, and for dyn Trait pointees those can have reference
481481
// type!

src/machine.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use rand::rngs::StdRng;
1212
use rand::Rng;
1313
use rand::SeedableRng;
1414

15-
use rustc_ast::ast::Mutability;
1615
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1716
#[allow(unused)]
1817
use rustc_data_structures::static_assert_size;
@@ -22,7 +21,7 @@ use rustc_middle::{
2221
ty::{
2322
self,
2423
layout::{LayoutCx, LayoutError, LayoutOf, TyAndLayout},
25-
Instance, Ty, TyCtxt, TypeAndMut,
24+
Instance, Ty, TyCtxt,
2625
},
2726
};
2827
use rustc_span::def_id::{CrateNum, DefId};
@@ -374,9 +373,9 @@ impl<'mir, 'tcx: 'mir> PrimitiveLayouts<'tcx> {
374373
fn new(layout_cx: LayoutCx<'tcx, TyCtxt<'tcx>>) -> Result<Self, &'tcx LayoutError<'tcx>> {
375374
let tcx = layout_cx.tcx;
376375
let mut_raw_ptr =
377-
Ty::new_ptr(tcx, TypeAndMut { ty: tcx.types.unit, mutbl: Mutability::Mut });
376+
Ty::new_mut_ptr(tcx, tcx.types.unit);
378377
let const_raw_ptr =
379-
Ty::new_ptr(tcx, TypeAndMut { ty: tcx.types.unit, mutbl: Mutability::Not });
378+
Ty::new_imm_ptr(tcx, tcx.types.unit);
380379
Ok(Self {
381380
unit: layout_cx.layout_of(Ty::new_unit(tcx))?,
382381
i8: layout_cx.layout_of(tcx.types.i8)?,

0 commit comments

Comments
 (0)