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
This commit is contained in:
commit
85e449a323
126 changed files with 409 additions and 578 deletions
|
@ -193,8 +193,8 @@ pub fn unsize_ptr<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
|||
) -> (Bx::Value, Bx::Value) {
|
||||
debug!("unsize_ptr: {:?} => {:?}", src_ty, dst_ty);
|
||||
match (src_ty.kind(), dst_ty.kind()) {
|
||||
(&ty::Ref(_, a, _), &ty::Ref(_, b, _) | &ty::RawPtr(ty::TypeAndMut { ty: b, .. }))
|
||||
| (&ty::RawPtr(ty::TypeAndMut { ty: a, .. }), &ty::RawPtr(ty::TypeAndMut { ty: b, .. })) => {
|
||||
(&ty::Ref(_, a, _), &ty::Ref(_, b, _) | &ty::RawPtr(b, _))
|
||||
| (&ty::RawPtr(a, _), &ty::RawPtr(b, _)) => {
|
||||
assert_eq!(bx.cx().type_is_sized(a), old_info.is_none());
|
||||
(src, unsized_info(bx, a, b, old_info))
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ fn push_debuginfo_type_name<'tcx>(
|
|||
output.push(')');
|
||||
}
|
||||
}
|
||||
ty::RawPtr(ty::TypeAndMut { ty: inner_type, mutbl }) => {
|
||||
ty::RawPtr(inner_type, mutbl) => {
|
||||
if cpp_like_debuginfo {
|
||||
match mutbl {
|
||||
Mutability::Not => output.push_str("ptr_const$<"),
|
||||
|
|
|
@ -414,10 +414,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
calculate_debuginfo_offset(bx, var.projection, base);
|
||||
|
||||
// Create a variable which will be a pointer to the actual value
|
||||
let ptr_ty = Ty::new_ptr(
|
||||
bx.tcx(),
|
||||
ty::TypeAndMut { mutbl: mir::Mutability::Mut, ty: place.layout.ty },
|
||||
);
|
||||
let ptr_ty = Ty::new_mut_ptr(bx.tcx(), place.layout.ty);
|
||||
let ptr_layout = bx.layout_of(ptr_ty);
|
||||
let alloca = PlaceRef::alloca(bx, ptr_layout);
|
||||
bx.set_var_name(alloca.llval, &(var.name.to_string() + ".dbg.spill"));
|
||||
|
|
|
@ -572,20 +572,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
|
||||
mir::Rvalue::Ref(_, bk, place) => {
|
||||
let mk_ref = move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| {
|
||||
Ty::new_ref(
|
||||
tcx,
|
||||
tcx.lifetimes.re_erased,
|
||||
ty::TypeAndMut { ty, mutbl: bk.to_mutbl_lossy() },
|
||||
)
|
||||
Ty::new_ref(tcx, tcx.lifetimes.re_erased, ty, bk.to_mutbl_lossy())
|
||||
};
|
||||
self.codegen_place_to_pointer(bx, place, mk_ref)
|
||||
}
|
||||
|
||||
mir::Rvalue::CopyForDeref(place) => self.codegen_operand(bx, &Operand::Copy(place)),
|
||||
mir::Rvalue::AddressOf(mutability, place) => {
|
||||
let mk_ptr = move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| {
|
||||
Ty::new_ptr(tcx, ty::TypeAndMut { ty, mutbl: mutability })
|
||||
};
|
||||
let mk_ptr =
|
||||
move |tcx: TyCtxt<'tcx>, ty: Ty<'tcx>| Ty::new_ptr(tcx, ty, mutability);
|
||||
self.codegen_place_to_pointer(bx, place, mk_ptr)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue