Move TyCtxt::mk_x
to Ty::new_x
where applicable
This commit is contained in:
parent
5dac6b320b
commit
12138b8e5e
164 changed files with 1386 additions and 1185 deletions
|
@ -170,7 +170,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
sym::pref_align_of | sym::variant_count => self.tcx.types.usize,
|
||||
sym::needs_drop => self.tcx.types.bool,
|
||||
sym::type_id => self.tcx.types.u128,
|
||||
sym::type_name => self.tcx.mk_static_str(),
|
||||
sym::type_name => Ty::new_static_str(self.tcx.tcx),
|
||||
_ => bug!(),
|
||||
};
|
||||
let val = self.ctfe_query(None, |tcx| {
|
||||
|
|
|
@ -22,7 +22,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
) -> InterpResult<'tcx> {
|
||||
let (val, overflowed, ty) = self.overflowing_binary_op(op, &left, &right)?;
|
||||
debug_assert_eq!(
|
||||
self.tcx.mk_tup(&[ty, self.tcx.types.bool]),
|
||||
Ty::new_tup(self.tcx.tcx, &[ty, self.tcx.types.bool]),
|
||||
dest.layout.ty,
|
||||
"type mismatch for result of {:?}",
|
||||
op,
|
||||
|
|
|
@ -9,6 +9,7 @@ use rustc_index::IndexSlice;
|
|||
use rustc_middle::mir;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_target::abi::{self, Abi, Align, FieldIdx, HasDataLayout, Size, FIRST_VARIANT};
|
||||
|
||||
use super::{
|
||||
|
@ -395,7 +396,7 @@ where
|
|||
// (Transmuting is okay since this is an in-memory place. We also double-check the size
|
||||
// stays the same.)
|
||||
let (len, e_ty) = mplace.layout.ty.simd_size_and_type(*self.tcx);
|
||||
let array = self.tcx.mk_array(e_ty, len);
|
||||
let array = Ty::new_array(self.tcx.tcx, e_ty, len);
|
||||
let layout = self.layout_of(array)?;
|
||||
assert_eq!(layout.size, mplace.layout.size);
|
||||
Ok((MPlaceTy { layout, ..*mplace }, len))
|
||||
|
@ -775,7 +776,8 @@ where
|
|||
let meta = Scalar::from_target_usize(u64::try_from(str.len()).unwrap(), self);
|
||||
let mplace = MemPlace { ptr: ptr.into(), meta: MemPlaceMeta::Meta(meta) };
|
||||
|
||||
let ty = self.tcx.mk_ref(
|
||||
let ty = Ty::new_ref(
|
||||
self.tcx.tcx,
|
||||
self.tcx.lifetimes.re_static,
|
||||
ty::TypeAndMut { ty: self.tcx.types.str_, mutbl },
|
||||
);
|
||||
|
|
|
@ -12,6 +12,7 @@ use either::{Left, Right};
|
|||
use rustc_middle::mir;
|
||||
use rustc_middle::ty;
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_target::abi::{self, Abi, VariantIdx};
|
||||
|
||||
use super::{
|
||||
|
@ -317,7 +318,9 @@ where
|
|||
let (meta, ty) = match base.layout.ty.kind() {
|
||||
// It is not nice to match on the type, but that seems to be the only way to
|
||||
// implement this.
|
||||
ty::Array(inner, _) => (MemPlaceMeta::None, self.tcx.mk_array(*inner, inner_len)),
|
||||
ty::Array(inner, _) => {
|
||||
(MemPlaceMeta::None, Ty::new_array(self.tcx.tcx, *inner, inner_len))
|
||||
}
|
||||
ty::Slice(..) => {
|
||||
let len = Scalar::from_target_usize(inner_len, self);
|
||||
(MemPlaceMeta::Meta(len), base.layout.ty)
|
||||
|
|
|
@ -650,7 +650,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
// Adjust receiver argument. Layout can be any (thin) ptr.
|
||||
args[0] = ImmTy::from_immediate(
|
||||
Scalar::from_maybe_pointer(adjusted_receiver, self).into(),
|
||||
self.layout_of(self.tcx.mk_mut_ptr(dyn_ty))?,
|
||||
self.layout_of(Ty::new_mut_ptr(self.tcx.tcx, dyn_ty))?,
|
||||
)
|
||||
.into();
|
||||
trace!("Patched receiver operand to {:#?}", args[0]);
|
||||
|
@ -703,7 +703,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
|
||||
let arg = ImmTy::from_immediate(
|
||||
place.to_ref(self),
|
||||
self.layout_of(self.tcx.mk_mut_ptr(place.layout.ty))?,
|
||||
self.layout_of(Ty::new_mut_ptr(self.tcx.tcx, place.layout.ty))?,
|
||||
);
|
||||
let ret = MPlaceTy::fake_alloc_zst(self.layout_of(self.tcx.types.unit)?);
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ impl Qualif for CustomEq {
|
|||
def: AdtDef<'tcx>,
|
||||
substs: SubstsRef<'tcx>,
|
||||
) -> bool {
|
||||
let ty = cx.tcx.mk_adt(def, substs);
|
||||
let ty = Ty::new_adt(cx.tcx, def, substs);
|
||||
!ty.is_structural_eq_shallow(cx.tcx)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ use rustc_middle::mir;
|
|||
use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Visitor};
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::subst::InternalSubsts;
|
||||
use rustc_middle::ty::{self, List, TyCtxt, TypeVisitableExt};
|
||||
use rustc_middle::ty::{self, List, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_span::Span;
|
||||
|
||||
use rustc_index::{Idx, IndexSlice, IndexVec};
|
||||
|
@ -867,7 +867,8 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
|
|||
let ty = local_decls[place.local].ty;
|
||||
let span = statement.source_info.span;
|
||||
|
||||
let ref_ty = tcx.mk_ref(
|
||||
let ref_ty = Ty::new_ref(
|
||||
tcx,
|
||||
tcx.lifetimes.re_erased,
|
||||
ty::TypeAndMut { ty, mutbl: borrow_kind.to_mutbl_lossy() },
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue