Hard
Dereferencing a raw pointer built from a callee's local
dangling() hands back a raw pointer built from one of its own locals. What happens when main dereferences that pointer inside the unsafe block?
main.rs
fn dangling() -> *const i32 {
let x = 42;
&x as *const i32
}
fn main() {
let ptr = dangling();
unsafe {
println!("{}", *ptr);
}
}35 of 53 in Rust