Skip to content

Commit b0c3e0f

Browse files
committed
rename TypeAndMut to RawPtr
1 parent be72f25 commit b0c3e0f

File tree

109 files changed

+302
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+302
-349
lines changed

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
359359
Some(variant.fields[field].name.to_string())
360360
}
361361
ty::Tuple(_) => Some(field.index().to_string()),
362-
ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => {
362+
ty::Ref(_, ty, _) | ty::RawPtr(ty::RawPtr { ty, .. }) => {
363363
self.describe_field_from_ty(ty, field, variant_index, including_tuple_field)
364364
}
365365
ty::Array(ty, _) | ty::Slice(ty) => {

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,12 +1272,12 @@ fn suggest_ampmut<'tcx>(
12721272
// otherwise, suggest that the user annotates the binding; we provide the
12731273
// type of the local.
12741274
let ty_mut = decl_ty.builtin_deref(true).unwrap();
1275-
assert_eq!(ty_mut.mutbl, hir::Mutability::Not);
1275+
assert_eq!(ty_mut.1, ty::Mutability::Not);
12761276

12771277
(
12781278
false,
12791279
span,
1280-
format!("{}mut {}", if decl_ty.is_ref() {"&"} else {"*"}, ty_mut.ty)
1280+
format!("{}mut {}", if decl_ty.is_ref() {"&"} else {"*"}, ty_mut.0)
12811281
)
12821282
}
12831283
}

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> {
403403
} else if let Some(static_def_id) = constant.check_static_ptr(tcx) {
404404
let unnormalized_ty = tcx.type_of(static_def_id).subst_identity();
405405
let normalized_ty = self.cx.normalize(unnormalized_ty, locations);
406-
let literal_ty = constant.literal.ty().builtin_deref(true).unwrap().ty;
406+
let literal_ty = constant.literal.ty().builtin_deref(true).unwrap().0;
407407

408408
if let Err(terr) = self.cx.eq_types(
409409
literal_ty,
@@ -638,7 +638,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
638638
match pi {
639639
ProjectionElem::Deref => {
640640
let deref_ty = base_ty.builtin_deref(true);
641-
PlaceTy::from_ty(deref_ty.map(|t| t.ty).unwrap_or_else(|| {
641+
PlaceTy::from_ty(deref_ty.map(|(ty, _)| ty).unwrap_or_else(|| {
642642
span_mirbug_and_err!(self, place, "deref of non-pointer {:?}", base_ty)
643643
}))
644644
}
@@ -2031,7 +2031,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20312031
}
20322032

20332033
CastKind::Pointer(PointerCast::MutToConstPointer) => {
2034-
let ty::RawPtr(ty::TypeAndMut {
2034+
let ty::RawPtr(ty::RawPtr {
20352035
ty: ty_from,
20362036
mutbl: hir::Mutability::Mut,
20372037
}) = op.ty(body, tcx).kind() else {
@@ -2043,7 +2043,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20432043
);
20442044
return;
20452045
};
2046-
let ty::RawPtr(ty::TypeAndMut {
2046+
let ty::RawPtr(ty::RawPtr {
20472047
ty: ty_to,
20482048
mutbl: hir::Mutability::Not,
20492049
}) = ty.kind() else {
@@ -2076,7 +2076,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20762076
let ty_from = op.ty(body, tcx);
20772077

20782078
let opt_ty_elem_mut = match ty_from.kind() {
2079-
ty::RawPtr(ty::TypeAndMut { mutbl: array_mut, ty: array_ty }) => {
2079+
ty::RawPtr(ty::RawPtr { mutbl: array_mut, ty: array_ty }) => {
20802080
match array_ty.kind() {
20812081
ty::Array(ty_elem, _) => Some((ty_elem, *array_mut)),
20822082
_ => None,
@@ -2096,7 +2096,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20962096
};
20972097

20982098
let (ty_to, ty_to_mut) = match ty.kind() {
2099-
ty::RawPtr(ty::TypeAndMut { mutbl: ty_to_mut, ty: ty_to }) => {
2099+
ty::RawPtr(ty::RawPtr { mutbl: ty_to_mut, ty: ty_to }) => {
21002100
(ty_to, *ty_to_mut)
21012101
}
21022102
_ => {

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,8 @@ pub(crate) fn codegen_drop<'tcx>(
667667
fx,
668668
fx.layout_of(fx.tcx.mk_ref(
669669
fx.tcx.lifetimes.re_erased,
670-
TypeAndMut { ty, mutbl: crate::rustc_hir::Mutability::Mut },
670+
ty,
671+
crate::rustc_hir::Mutability::Mut,
671672
)),
672673
);
673674
let arg_value = adjust_arg_for_abi(fx, arg_value, &fn_abi.args[0], true);

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ fn codegen_stmt<'tcx>(
631631

632632
fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
633633
ty.builtin_deref(true).is_some_and(
634-
|ty::TypeAndMut { ty: pointee_ty, mutbl: _ }| {
634+
|(pointee_ty, _)| {
635635
has_ptr_meta(fx.tcx, pointee_ty)
636636
},
637637
)

compiler/rustc_codegen_cranelift/src/common.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rustc_index::IndexVec;
66
use rustc_middle::ty::layout::{
77
FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers,
88
};
9+
use rustc_middle::ty::RawPtr;
910
use rustc_span::SourceFile;
1011
use rustc_target::abi::call::FnAbi;
1112
use rustc_target::abi::{Integer, Primitive};
@@ -65,7 +66,7 @@ fn clif_type_from_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<types::Typ
6566
FloatTy::F64 => types::F64,
6667
},
6768
ty::FnPtr(_) => pointer_ty(tcx),
68-
ty::RawPtr(TypeAndMut { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {
69+
ty::RawPtr(RawPtr { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {
6970
if has_ptr_meta(tcx, *pointee_ty) {
7071
return None;
7172
} else {
@@ -85,7 +86,7 @@ fn clif_pair_type_from_ty<'tcx>(
8586
ty::Tuple(types) if types.len() == 2 => {
8687
(clif_type_from_ty(tcx, types[0])?, clif_type_from_ty(tcx, types[1])?)
8788
}
88-
ty::RawPtr(TypeAndMut { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {
89+
ty::RawPtr(RawPtr { ty: pointee_ty, mutbl: _ }) | ty::Ref(_, pointee_ty, _) => {
8990
if has_ptr_meta(tcx, *pointee_ty) {
9091
(pointer_ty(tcx), pointer_ty(tcx))
9192
} else {
@@ -98,7 +99,7 @@ fn clif_pair_type_from_ty<'tcx>(
9899

99100
/// Is a pointer to this type a fat ptr?
100101
pub(crate) fn has_ptr_meta<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
101-
let ptr_ty = tcx.mk_ptr(TypeAndMut { ty, mutbl: rustc_hir::Mutability::Not });
102+
let ptr_ty = tcx.mk_ptr(RawPtr { ty, mutbl: rustc_hir::Mutability::Not });
102103
match &tcx.layout_of(ParamEnv::reveal_all().and(ptr_ty)).unwrap().abi {
103104
Abi::Scalar(_) => false,
104105
Abi::ScalarPair(_, _) => true,

compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
534534
intrinsic_args!(fx, args => (base, offset); intrinsic);
535535
let offset = offset.load_scalar(fx);
536536

537-
let pointee_ty = base.layout().ty.builtin_deref(true).unwrap().ty;
537+
let pointee_ty = base.layout().ty.builtin_deref(true).unwrap().0;
538538
let pointee_size = fx.layout_of(pointee_ty).size.bytes();
539539
let ptr_diff = if pointee_size != 1 {
540540
fx.bcx.ins().imul_imm(offset, pointee_size as i64)
@@ -558,7 +558,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
558558
let val = val.load_scalar(fx);
559559
let count = count.load_scalar(fx);
560560

561-
let pointee_ty = dst.layout().ty.builtin_deref(true).unwrap().ty;
561+
let pointee_ty = dst.layout().ty.builtin_deref(true).unwrap().0;
562562
let pointee_size = fx.layout_of(pointee_ty).size.bytes();
563563
let count = if pointee_size != 1 {
564564
fx.bcx.ins().imul_imm(count, pointee_size as i64)
@@ -660,7 +660,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
660660

661661
// Cranelift treats loads as volatile by default
662662
// FIXME correctly handle unaligned_volatile_load
663-
let inner_layout = fx.layout_of(ptr.layout().ty.builtin_deref(true).unwrap().ty);
663+
let inner_layout = fx.layout_of(ptr.layout().ty.builtin_deref(true).unwrap().0);
664664
let val = CValue::by_ref(Pointer::new(ptr.load_scalar(fx)), inner_layout);
665665
ret.write_cvalue(fx, val);
666666
}

compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
778778
intrinsic_args!(fx, args => (ptr, offset); intrinsic);
779779

780780
let (lane_count, ptr_lane_ty) = ptr.layout().ty.simd_size_and_type(fx.tcx);
781-
let pointee_ty = ptr_lane_ty.builtin_deref(true).unwrap().ty;
781+
let pointee_ty = ptr_lane_ty.builtin_deref(true).unwrap().0;
782782
let pointee_size = fx.layout_of(pointee_ty).size.bytes();
783783
let (ret_lane_count, ret_lane_ty) = ret.layout().ty.simd_size_and_type(fx.tcx);
784784
let ret_lane_layout = fx.layout_of(ret_lane_ty);

compiler/rustc_codegen_cranelift/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ mod prelude {
8383
pub(crate) use rustc_middle::mir::{self, *};
8484
pub(crate) use rustc_middle::ty::layout::{self, LayoutOf, TyAndLayout};
8585
pub(crate) use rustc_middle::ty::{
86-
self, FloatTy, Instance, InstanceDef, IntTy, ParamEnv, Ty, TyCtxt, TypeAndMut,
87-
TypeFoldable, TypeVisitableExt, UintTy,
86+
self, FloatTy, Instance, InstanceDef, IntTy, ParamEnv, Ty, TyCtxt, TypeFoldable,
87+
TypeVisitableExt, UintTy,
8888
};
8989
pub(crate) use rustc_target::abi::{Abi, FieldIdx, Scalar, Size, VariantIdx, FIRST_VARIANT};
9090

compiler/rustc_codegen_cranelift/src/num.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pub(crate) fn codegen_ptr_binop<'tcx>(
368368
.layout()
369369
.ty
370370
.builtin_deref(true)
371-
.map(|TypeAndMut { ty, mutbl: _ }| !has_ptr_meta(fx.tcx, ty))
371+
.map(|(ty, _)| !has_ptr_meta(fx.tcx, ty))
372372
.unwrap_or(true);
373373

374374
if is_thin_ptr {
@@ -380,7 +380,7 @@ pub(crate) fn codegen_ptr_binop<'tcx>(
380380
codegen_compare_bin_op(fx, bin_op, false, lhs, rhs)
381381
}
382382
BinOp::Offset => {
383-
let pointee_ty = in_lhs.layout().ty.builtin_deref(true).unwrap().ty;
383+
let pointee_ty = in_lhs.layout().ty.builtin_deref(true).unwrap().0;
384384
let (base, offset) = (in_lhs, in_rhs.load_scalar(fx));
385385
let pointee_size = fx.layout_of(pointee_ty).size.bytes();
386386
let ptr_diff = fx.bcx.ins().imul_imm(offset, pointee_size as i64);

compiler/rustc_codegen_cranelift/src/unsize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ fn unsize_ptr<'tcx>(
6868
) -> (Value, Value) {
6969
match (&src_layout.ty.kind(), &dst_layout.ty.kind()) {
7070
(&ty::Ref(_, a, _), &ty::Ref(_, b, _))
71-
| (&ty::Ref(_, a, _), &ty::RawPtr(ty::TypeAndMut { ty: b, .. }))
72-
| (&ty::RawPtr(ty::TypeAndMut { ty: a, .. }), &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) => {
71+
| (&ty::Ref(_, a, _), &ty::RawPtr(ty::RawPtr { ty: b, .. }))
72+
| (&ty::RawPtr(ty::RawPtr { ty: a, .. }), &ty::RawPtr(ty::RawPtr { ty: b, .. })) => {
7373
(src, unsized_info(fx, *a, *b, old_info))
7474
}
7575
(&ty::Adt(def_a, _), &ty::Adt(def_b, _)) if def_a.is_box() && def_b.is_box() => {
@@ -130,7 +130,7 @@ pub(crate) fn coerce_unsized_into<'tcx>(
130130
let dst_ty = dst.layout().ty;
131131
let mut coerce_ptr = || {
132132
let (base, info) =
133-
if fx.layout_of(src.layout().ty.builtin_deref(true).unwrap().ty).is_unsized() {
133+
if fx.layout_of(src.layout().ty.builtin_deref(true).unwrap().0).is_unsized() {
134134
let (old_base, old_info) = src.load_scalar_pair(fx);
135135
unsize_ptr(fx, old_base, src.layout(), dst.layout(), Some(old_info))
136136
} else {

compiler/rustc_codegen_cranelift/src/value_and_place.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use crate::prelude::*;
55
use cranelift_codegen::entity::EntityRef;
66
use cranelift_codegen::ir::immediates::Offset32;
77

8+
use rustc_middle::ty::RawPtr;
9+
810
fn codegen_field<'tcx>(
911
fx: &mut FunctionCx<'_, '_, 'tcx>,
1012
base: Pointer,
@@ -731,7 +733,7 @@ impl<'tcx> CPlace<'tcx> {
731733
}
732734

733735
pub(crate) fn place_deref(self, fx: &mut FunctionCx<'_, '_, 'tcx>) -> CPlace<'tcx> {
734-
let inner_layout = fx.layout_of(self.layout().ty.builtin_deref(true).unwrap().ty);
736+
let inner_layout = fx.layout_of(self.layout().ty.builtin_deref(true).unwrap().0);
735737
if has_ptr_meta(fx.tcx, inner_layout.ty) {
736738
let (addr, extra) = self.to_cvalue(fx).load_scalar_pair(fx);
737739
CPlace::for_ptr_with_extra(Pointer::new(addr), extra, inner_layout)
@@ -779,14 +781,11 @@ pub(crate) fn assert_assignable<'tcx>(
779781
}
780782
match (from_ty.kind(), to_ty.kind()) {
781783
(ty::Ref(_, a, _), ty::Ref(_, b, _))
782-
| (
783-
ty::RawPtr(TypeAndMut { ty: a, mutbl: _ }),
784-
ty::RawPtr(TypeAndMut { ty: b, mutbl: _ }),
785-
) => {
784+
| (ty::RawPtr(RawPtr { ty: a, mutbl: _ }), ty::RawPtr(RawPtr { ty: b, mutbl: _ })) => {
786785
assert_assignable(fx, *a, *b, limit - 1);
787786
}
788-
(ty::Ref(_, a, _), ty::RawPtr(TypeAndMut { ty: b, mutbl: _ }))
789-
| (ty::RawPtr(TypeAndMut { ty: a, mutbl: _ }), ty::Ref(_, b, _)) => {
787+
(ty::Ref(_, a, _), ty::RawPtr(RawPtr { ty: b, mutbl: _ }))
788+
| (ty::RawPtr(RawPtr { ty: a, mutbl: _ }), ty::Ref(_, b, _)) => {
790789
assert_assignable(fx, *a, *b, limit - 1);
791790
}
792791
(ty::FnPtr(_), ty::FnPtr(_)) => {

compiler/rustc_codegen_cranelift/src/vtable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
6666

6767
if let ty::Ref(_, ty, _) = arg.layout().ty.kind() {
6868
if ty.is_dyn_star() {
69-
let inner_layout = fx.layout_of(arg.layout().ty.builtin_deref(true).unwrap().ty);
69+
let inner_layout = fx.layout_of(arg.layout().ty.builtin_deref(true).unwrap().0);
7070
let dyn_star = CPlace::for_ptr(Pointer::new(arg.load_scalar(fx)), inner_layout);
7171
let ptr = dyn_star.place_field(fx, FieldIdx::new(0)).to_ptr();
7272
let vtable =

compiler/rustc_codegen_gcc/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
191191
}
192192
let ty =
193193
match *self.ty.kind() {
194-
ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => {
194+
ty::Ref(_, ty, _) | ty::RawPtr(ty::RawPtr { ty, .. }) => {
195195
cx.type_ptr_to(cx.layout_of(ty).gcc_type(cx))
196196
}
197197
ty::Adt(def, _) if def.is_box() => {

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
552552
let element_type_index = unsafe { llvm::LLVMRustGetElementTypeArgIndex(callsite) };
553553
if element_type_index >= 0 {
554554
let arg_ty = self.args[element_type_index as usize].layout.ty;
555-
let pointee_ty = arg_ty.builtin_deref(true).expect("Must be pointer argument").ty;
555+
let pointee_ty = arg_ty.builtin_deref(true).expect("Must be pointer argument").0;
556556
let element_type_attr = unsafe {
557557
llvm::LLVMRustCreateElementTypeAttr(bx.llcx, bx.layout_of(pointee_ty).llvm_type(bx))
558558
};

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ pub fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll D
441441
ty::Slice(_) | ty::Str => build_slice_type_di_node(cx, t, unique_type_id),
442442
ty::Dynamic(..) => build_dyn_type_di_node(cx, t, unique_type_id),
443443
ty::Foreign(..) => build_foreign_type_di_node(cx, t, unique_type_id),
444-
ty::RawPtr(ty::TypeAndMut { ty: pointee_type, .. }) | ty::Ref(_, pointee_type, _) => {
444+
ty::RawPtr(ty::RawPtr { ty: pointee_type, .. }) | ty::Ref(_, pointee_type, _) => {
445445
build_pointer_or_reference_di_node(cx, t, pointee_type, unique_type_id)
446446
}
447447
// Box<T, A> may have a non-ZST allocator A. In that case, we

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1997,7 +1997,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
19971997
let pointee = in_elem.builtin_deref(true).unwrap_or_else(|| {
19981998
span_bug!(span, "must be called with a vector of pointer types as first argument")
19991999
});
2000-
let layout = bx.layout_of(pointee.ty);
2000+
let layout = bx.layout_of(pointee.0);
20012001
let ptrs = args[0].immediate();
20022002
// The second argument must be a ptr-sized integer.
20032003
// (We don't care about the signedness, this is wrapping anyway.)

compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
229229
return llty;
230230
}
231231
let llty = match *self.ty.kind() {
232-
ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => {
232+
ty::Ref(_, ty, _) | ty::RawPtr(ty::RawPtr { ty, .. }) => {
233233
cx.type_ptr_to(cx.layout_of(ty).llvm_type(cx))
234234
}
235235
ty::Adt(def, _) if def.is_box() => {

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ pub fn unsize_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
218218
) -> (Bx::Value, Bx::Value) {
219219
debug!("unsize_ptr: {:?} => {:?}", src_ty, dst_ty);
220220
match (src_ty.kind(), dst_ty.kind()) {
221-
(&ty::Ref(_, a, _), &ty::Ref(_, b, _) | &ty::RawPtr(ty::TypeAndMut { ty: b, .. }))
222-
| (&ty::RawPtr(ty::TypeAndMut { ty: a, .. }), &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) => {
221+
(&ty::Ref(_, a, _), &ty::Ref(_, b, _) | &ty::RawPtr(ty::RawPtr { ty: b, .. }))
222+
| (&ty::RawPtr(ty::RawPtr { ty: a, .. }), &ty::RawPtr(ty::RawPtr { ty: b, .. })) => {
223223
assert_eq!(bx.cx().type_is_sized(a), old_info.is_none());
224224
let ptr_ty = bx.cx().type_ptr_to(bx.cx().backend_type(bx.cx().layout_of(b)));
225225
(bx.pointercast(src, ptr_ty), unsized_info(bx, a, b, old_info))

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn push_debuginfo_type_name<'tcx>(
138138
output.push(')');
139139
}
140140
}
141-
ty::RawPtr(ty::TypeAndMut { ty: inner_type, mutbl }) => {
141+
ty::RawPtr(ty::RawPtr { ty: inner_type, mutbl }) => {
142142
if cpp_like_debuginfo {
143143
match mutbl {
144144
Mutability::Not => output.push_str("ptr_const$<"),

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
988988

989989
// Make sure that we've actually unwrapped the rcvr down
990990
// to a pointer or ref to `dyn* Trait`.
991-
if !op.layout.ty.builtin_deref(true).unwrap().ty.is_dyn_star() {
991+
if !op.layout.ty.builtin_deref(true).unwrap().0.is_dyn_star() {
992992
span_bug!(span, "can't codegen a virtual call on {:#?}", op);
993993
}
994994
let place = op.deref(bx.cx());

compiler/rustc_codegen_ssa/src/mir/debuginfo.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> DebugInfoOffsetLocation<'tcx, Bx>
117117
{
118118
fn deref(&self, bx: &mut Bx) -> Self {
119119
bx.cx().layout_of(
120-
self.ty.builtin_deref(true).unwrap_or_else(|| bug!("cannot deref `{}`", self.ty)).ty,
120+
self.ty.builtin_deref(true).unwrap_or_else(|| bug!("cannot deref `{}`", self.ty)).0,
121121
)
122122
}
123123

@@ -418,9 +418,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
418418

419419
let create_alloca = |bx: &mut Bx, place: PlaceRef<'tcx, Bx::Value>, refcount| {
420420
// Create a variable which will be a pointer to the actual value
421-
let ptr_ty = bx
422-
.tcx()
423-
.mk_ptr(ty::TypeAndMut { mutbl: mir::Mutability::Mut, ty: place.layout.ty });
421+
let ptr_ty =
422+
bx.tcx().mk_ptr(ty::RawPtr { mutbl: mir::Mutability::Mut, ty: place.layout.ty });
424423
let ptr_layout = bx.layout_of(ptr_ty);
425424
let alloca = PlaceRef::alloca(bx, ptr_layout);
426425
bx.set_var_name(alloca.llval, &format!("{}.ref{}.dbg.spill", var.name, refcount));
@@ -523,7 +522,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
523522

524523
for _ in 0..var.references {
525524
var_ty =
526-
bx.tcx().mk_ptr(ty::TypeAndMut { mutbl: mir::Mutability::Mut, ty: var_ty });
525+
bx.tcx().mk_ptr(ty::RawPtr { mutbl: mir::Mutability::Mut, ty: var_ty });
527526
}
528527

529528
self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span)

0 commit comments

Comments
 (0)