show alignedness of ByRefs; allow converting unaligned ByRef to ptr
This commit is contained in:
parent
6fb6a1c4d0
commit
62334acd66
@ -1575,9 +1575,9 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||
Err(err) => {
|
||||
panic!("Failed to access local: {:?}", err);
|
||||
}
|
||||
Ok(Value::ByRef(ptr, _aligned)) => match ptr.into_inner_primval() {
|
||||
Ok(Value::ByRef(ptr, aligned)) => match ptr.into_inner_primval() {
|
||||
PrimVal::Ptr(ptr) => {
|
||||
write!(msg, " by ref:").unwrap();
|
||||
write!(msg, " by {}ref:", if aligned { "" } else { "unaligned " }).unwrap();
|
||||
allocs.push(ptr.alloc_id);
|
||||
},
|
||||
ptr => write!(msg, " integral by ref: {:?}", ptr).unwrap(),
|
||||
|
@ -86,9 +86,10 @@ impl<'tcx> Lvalue<'tcx> {
|
||||
}
|
||||
|
||||
pub(super) fn to_ptr(self) -> EvalResult<'tcx, MemoryPointer> {
|
||||
let (ptr, extra, aligned) = self.to_ptr_extra_aligned();
|
||||
let (ptr, extra, _aligned) = self.to_ptr_extra_aligned();
|
||||
// At this point, we forget about the alignment information -- the lvalue has been turned into a reference,
|
||||
// and no matter where it came from, it now must be aligned.
|
||||
assert_eq!(extra, LvalueExtra::None);
|
||||
assert_eq!(aligned, true, "tried converting an unaligned lvalue into a ptr");
|
||||
ptr.to_ptr()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user