summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_const_eval/src/const_eval/valtrees.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_const_eval/src/const_eval/valtrees.rs')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/valtrees.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/valtrees.rs b/compiler/rustc_const_eval/src/const_eval/valtrees.rs
index 498c00873..a73f778d4 100644
--- a/compiler/rustc_const_eval/src/const_eval/valtrees.rs
+++ b/compiler/rustc_const_eval/src/const_eval/valtrees.rs
@@ -151,7 +151,7 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
// FIXME(oli-obk): we can probably encode closures just like structs
| ty::Closure(..)
| ty::Generator(..)
- | ty::GeneratorWitness(..) => Err(ValTreeCreationError::NonSupportedType),
+ | ty::GeneratorWitness(..) |ty::GeneratorWitnessMIR(..)=> Err(ValTreeCreationError::NonSupportedType),
}
}
@@ -193,7 +193,7 @@ fn get_info_on_unsized_field<'tcx>(
// Have to adjust type for ty::Str
let unsized_inner_ty = match unsized_inner_ty.kind() {
- ty::Str => tcx.mk_ty(ty::Uint(ty::UintTy::U8)),
+ ty::Str => tcx.types.u8,
_ => unsized_inner_ty,
};
@@ -216,7 +216,7 @@ fn create_pointee_place<'tcx>(
let (unsized_inner_ty, num_elems) = get_info_on_unsized_field(ty, valtree, tcx);
let unsized_inner_ty = match unsized_inner_ty.kind() {
- ty::Str => tcx.mk_ty(ty::Uint(ty::UintTy::U8)),
+ ty::Str => tcx.types.u8,
_ => unsized_inner_ty,
};
let unsized_inner_ty_size =
@@ -239,7 +239,7 @@ fn create_pointee_place<'tcx>(
MPlaceTy::from_aligned_ptr_with_meta(
ptr.into(),
layout,
- MemPlaceMeta::Meta(Scalar::from_machine_usize(num_elems as u64, &tcx)),
+ MemPlaceMeta::Meta(Scalar::from_target_usize(num_elems as u64, &tcx)),
)
} else {
create_mplace_from_layout(ecx, ty)
@@ -314,6 +314,7 @@ pub fn valtree_to_const_value<'tcx>(
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
+ | ty::GeneratorWitnessMIR(..)
| ty::FnPtr(_)
| ty::RawPtr(_)
| ty::Str
@@ -354,7 +355,7 @@ fn valtree_into_mplace<'tcx>(
let imm = match inner_ty.kind() {
ty::Slice(_) | ty::Str => {
let len = valtree.unwrap_branch().len();
- let len_scalar = Scalar::from_machine_usize(len as u64, &tcx);
+ let len_scalar = Scalar::from_target_usize(len as u64, &tcx);
Immediate::ScalarPair(
Scalar::from_maybe_pointer((*pointee_place).ptr, &tcx),
@@ -425,7 +426,7 @@ fn valtree_into_mplace<'tcx>(
place
.offset_with_meta(
offset,
- MemPlaceMeta::Meta(Scalar::from_machine_usize(
+ MemPlaceMeta::Meta(Scalar::from_target_usize(
num_elems as u64,
&tcx,
)),