Closed
Description
The following program should pass, but is incorrectly considered UB:
#![feature(raw_ref_op)]
fn main() {
#[repr(packed)]
struct S {
fill: u8,
a: i32,
b: i64,
}
let mut x = S {
fill: 0,
a: 42,
b: 99,
};
assert_eq!(unsafe { (&raw const x.a).read_unaligned() }, 42);
assert_eq!(unsafe { (&raw const x.b).read_unaligned() }, 99);
}
The error source seems to be related to Stacked Borrows.