1
Fork 0

Ty::new_ref and Ty::new_ptr stop using TypeAndMut

This commit is contained in:
Michael Goulet 2024-03-21 17:07:52 -04:00
parent 81e7e80990
commit f0f224a37f
23 changed files with 68 additions and 125 deletions

View file

@ -94,7 +94,7 @@ use rustc_middle::mir::interpret::GlobalAlloc;
use rustc_middle::mir::visit::*;
use rustc_middle::mir::*;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeAndMut};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::def_id::DefId;
use rustc_span::DUMMY_SP;
use rustc_target::abi::{self, Abi, Size, VariantIdx, FIRST_VARIANT};
@ -451,11 +451,10 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
AddressKind::Ref(bk) => Ty::new_ref(
self.tcx,
self.tcx.lifetimes.re_erased,
ty::TypeAndMut { ty: mplace.layout.ty, mutbl: bk.to_mutbl_lossy() },
mplace.layout.ty,
bk.to_mutbl_lossy(),
),
AddressKind::Address(mutbl) => {
Ty::new_ptr(self.tcx, TypeAndMut { ty: mplace.layout.ty, mutbl })
}
AddressKind::Address(mutbl) => Ty::new_ptr(self.tcx, mplace.layout.ty, mutbl),
};
let layout = self.ecx.layout_of(ty).ok()?;
ImmTy::from_immediate(pointer, layout).into()

View file

@ -820,11 +820,8 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
let ty = local_decls[place.local].ty;
let span = statement.source_info.span;
let ref_ty = Ty::new_ref(
tcx,
tcx.lifetimes.re_erased,
ty::TypeAndMut { ty, mutbl: borrow_kind.to_mutbl_lossy() },
);
let ref_ty =
Ty::new_ref(tcx, tcx.lifetimes.re_erased, ty, borrow_kind.to_mutbl_lossy());
let mut projection = vec![PlaceElem::Deref];
projection.extend(place.projection);