Is this code technically safe?
#[derive(Default, Debug)]
struct Hello {
a: u32,
b: u32,
c: u32,
}
fn do_something(h: &mut Hello) {
// NEVER TOUCH h.a
h.b = 10;
h.c = 15;
}
fn main() {
let mut h = Hello::default();
let a = &mut h.a as *mut u32; // Normally this would be a borrowing err
do_something(&mut h);
unsafe {
*a = 5;
}
println!("{:?}", h);
}
If I never touch h.a.