try_validation!(
self.ecx.read_drop_type_from_vtable(vtable),
self.path,
- err_ub!(InvalidDropFn(..)) |
err_ub!(DanglingIntPointer(..)) |
err_ub!(InvalidFunctionPointer(..)) |
err_unsup!(ReadBytesAsPointer) =>
- { "invalid drop function pointer in vtable" },
+ { "invalid drop function pointer in vtable (not pointing to a function)" },
+ err_ub!(InvalidDropFn(..)) =>
+ { "invalid drop function pointer in vtable (function has incompatible signature)" },
);
try_validation!(
self.ecx.read_size_and_align_from_vtable(vtable),
let place = try_validation!(
self.ecx.ref_to_mplace(value),
self.path,
- err_ub!(InvalidUndefBytes(..)) => { "uninitialized {}", kind },
+ err_ub!(InvalidUninitBytes(..)) => { "uninitialized {}", kind },
);
if place.layout.is_unsized() {
self.check_wide_ptr_meta(place.meta, place.layout)?;
err_ub!(DanglingIntPointer(0, _)) =>
{ "a NULL {}", kind },
err_ub!(DanglingIntPointer(i, _)) =>
- { "a dangling {} (address {} is unallocated)", kind, i },
+ { "a dangling {} (address 0x{:x} is unallocated)", kind, i },
err_ub!(PointerOutOfBounds { .. }) =>
{ "a dangling {} (going beyond the bounds of its allocation)", kind },
err_unsup!(ReadBytesAsPointer) =>
if let Some(ptr) = ptr {
// not a ZST
// Skip validation entirely for some external statics
- let alloc_kind = self.ecx.tcx.alloc_map.lock().get(ptr.alloc_id);
+ let alloc_kind = self.ecx.tcx.get_global_alloc(ptr.alloc_id);
if let Some(GlobalAlloc::Static(did)) = alloc_kind {
// See const_eval::machine::MemoryExtra::can_access_statics for why
// this check is so important.
let place = try_validation!(
self.ecx.ref_to_mplace(self.ecx.read_immediate(value)?),
self.path,
- err_ub!(InvalidUndefBytes(..)) => { "uninitialized raw pointer" },
+ err_ub!(InvalidUninitBytes(..)) => { "uninitialized raw pointer" },
);
if place.layout.is_unsized() {
self.check_wide_ptr_meta(place.meta, place.layout)?;
let value = try_validation!(
value.not_undef(),
self.path,
- err_ub!(InvalidUndefBytes(..)) => { "{}", value }
+ err_ub!(InvalidUninitBytes(..)) => { "{}", value }
expected { "something {}", wrapping_range_format(valid_range, max_hi) },
);
let bits = match value.to_bits_or_ptr(op.layout.size, self.ecx) {
// For some errors we might be able to provide extra information.
// (This custom logic does not fit the `try_validation!` macro.)
match err.kind {
- err_ub!(InvalidUndefBytes(Some(ptr))) => {
+ err_ub!(InvalidUninitBytes(Some(ptr))) => {
// Some byte was uninitialized, determine which
// element that byte belongs to so we can
// provide an index.