mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
show alignedness of ByRefs; allow converting unaligned ByRef to ptr
This commit is contained in:
+2
-2
@@ -1575,9 +1575,9 @@ pub(super) fn dump_local(&self, lvalue: Lvalue<'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(),
|
||||
|
||||
+3
-2
@@ -86,9 +86,10 @@ pub(super) fn to_ptr_extra_aligned(self) -> (Pointer, LvalueExtra, bool) {
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user