use hir::map::definitions::DefPathData;
use mir;
use ty::{self, Ty, layout};
-use ty::layout::{Size, AbiAndPrefAlign, LayoutError};
+use ty::layout::{Size, Align, LayoutError};
use rustc_target::spec::abi::Abi;
use super::{RawConst, Pointer, InboundsCheck, ScalarMaybeUndef};
TlsOutOfBounds,
AbiViolation(String),
AlignmentCheckFailed {
- required: AbiAndPrefAlign,
- has: AbiAndPrefAlign,
+ required: Align,
+ has: Align,
},
ValidationFailure(String),
CalledClosureAsFunction,
VtableForArgumentlessMethod,
ModifiedConstantMemory,
+ ModifiedStatic,
AssumptionNotHeld,
InlineAsm,
TypeNotPrimitive(Ty<'tcx>),
DeallocatedWrongMemoryKind(String, String),
ReallocateNonBasePtr,
DeallocateNonBasePtr,
- IncorrectAllocationInformation(Size, Size, AbiAndPrefAlign, AbiAndPrefAlign),
+ IncorrectAllocationInformation(Size, Size, Align, Align),
Layout(layout::LayoutError<'tcx>),
HeapAllocZeroBytes,
HeapAllocNonPowerOfTwoAlignment(u64),
"tried to read from foreign (extern) static",
InvalidPointerMath =>
"attempted to do invalid arithmetic on pointers that would leak base addresses, \
- e.g. comparing pointers into different allocations",
+ e.g., comparing pointers into different allocations",
ReadUndefBytes(_) =>
"attempted to read undefined bytes",
DeadLocal =>
"tried to call a vtable function without arguments",
ModifiedConstantMemory =>
"tried to modify constant memory",
+ ModifiedStatic =>
+ "tried to modify a static's initial value from another static's initializer",
AssumptionNotHeld =>
"`assume` argument was false",
InlineAsm =>
write!(f, "tried to interpret an invalid 32-bit value as a char: {}", c),
AlignmentCheckFailed { required, has } =>
write!(f, "tried to access memory with alignment {}, but alignment {} is required",
- has.abi(), required.abi()),
+ has.bytes(), required.bytes()),
TypeNotPrimitive(ty) =>
write!(f, "expected primitive type, got {}", ty),
Layout(ref err) =>
MachineError(ref inner) =>
write!(f, "{}", inner),
IncorrectAllocationInformation(size, size2, align, align2) =>
- write!(f, "incorrect alloc info: expected size {} and align {}, got size {} and \
- align {}", size.bytes(), align.abi(), size2.bytes(), align2.abi()),
+ write!(f, "incorrect alloc info: expected size {} and align {}, \
+ got size {} and align {}",
+ size.bytes(), align.bytes(), size2.bytes(), align2.bytes()),
Panic { ref msg, line, col, ref file } =>
write!(f, "the evaluated program panicked at '{}', {}:{}:{}", msg, file, line, col),
InvalidDiscriminant(val) =>