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.
cc @oli-obk @RalfJung
This code (playground):
errors under miri with
This snippet, however (playground):
errors with
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.
cc @oli-obk @RalfJung