diff --git a/src/eval_context.rs b/src/eval_context.rs index a4ce1d327e3a..1e57adbcf3ea 100644 --- a/src/eval_context.rs +++ b/src/eval_context.rs @@ -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(), diff --git a/src/lvalue.rs b/src/lvalue.rs index 79b8d50c96e6..86e09356fd76 100644 --- a/src/lvalue.rs +++ b/src/lvalue.rs @@ -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() }