32 bit platforms don't have 64 bit pointers

This commit is contained in:
Oliver Scherer 2020-10-01 12:51:44 +02:00 committed by oli
parent eac309984f
commit ed7a4adeb3

View File

@ -14,7 +14,7 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{self, subst::Subst, TyCtxt};
use rustc_span::source_map::Span;
use rustc_target::abi::{Abi, LayoutOf};
use std::convert::{TryFrom, TryInto};
use std::convert::TryInto;
pub fn note_on_undefined_behavior_error() -> &'static str {
"The rules on what exactly is undefined behavior aren't clear, \
@ -140,7 +140,8 @@ pub(super) fn op_to_const<'tcx>(
Scalar::Raw(int) => {
assert!(mplace.layout.is_zst());
assert_eq!(
u64::try_from(int).unwrap() % mplace.layout.align.abi.bytes(),
int.assert_bits(ecx.tcx.data_layout.pointer_size)
% u128::from(mplace.layout.align.abi.bytes()),
0,
"this MPlaceTy must come from a validated constant, thus we can assume the \
alignment is correct",