Closed
Description
This code (playground):
fn main() {
unsafe {
use std::mem::transmute;
let a = 0_u8;
let b = &a as *const u8 as *const u64;
//let _c: &u64 = transmute(b);
let _d = *b;
}
}
errors under miri with
tried to access memory with alignment 1, but alignment 8 is required
This snippet, however (playground):
fn main() {
unsafe {
use std::mem::transmute;
let a = 0_u8;
let b = &a as *const u8 as *const u64;
let _c: &u64 = transmute(b);
//let _d = *b;
}
}
errors with
type validation failed: encountered unaligned reference
It would be great if this error about the validity of references would also state that "alignment 1, but alignment 8 is required" or similar.
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Messages for errors, warnings, and lintsCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.