use std::hash::Hash;
use std::ops::RangeInclusive;
-use syntax_pos::symbol::Symbol;
+use syntax_pos::symbol::{sym, Symbol};
use rustc::hir;
use rustc::ty::layout::{self, Size, Align, TyLayout, LayoutOf, VariantIdx};
use rustc::ty;
use rustc_data_structures::fx::FxHashSet;
use rustc::mir::interpret::{
- Scalar, AllocKind, EvalResult, InterpError,
+ Scalar, AllocKind, EvalResult, InterpError, CheckInAllocMsg,
};
use super::{
PathElem::ClosureVar(name.unwrap_or_else(|| {
// Fall back to showing the field index.
- Symbol::intern(&field.to_string())
+ sym::integer(field)
}))
}
try_validation!(
self.ecx.memory
.get(ptr.alloc_id)?
- .check_bounds(self.ecx, ptr, size),
+ .check_bounds(self.ecx, ptr, size, CheckInAllocMsg::InboundsTest),
"dangling (not entirely in bounds) reference", self.path);
}
// Check if we have encountered this pointer+layout combination
wrapping_range_format(&layout.valid_range, max_hi),
)
);
- let bits = match value {
- Scalar::Ptr(ptr) => {
+ let bits = match value.to_bits_or_ptr(op.layout.size, self.ecx) {
+ Err(ptr) => {
if lo == 1 && hi == max_hi {
// only NULL is not allowed.
// We can call `check_align` to check non-NULL-ness, but have to also look
);
}
}
- Scalar::Raw { data, size } => {
- assert_eq!(size as u64, op.layout.size.bytes());
+ Ok(data) =>
data
- }
};
// Now compare. This is slightly subtle because this is a special "wrap-around" range.
if wrapping_range_contains(&layout.valid_range, bits) {