I read the explanation of E0716, but still can't thoroughly understand the following code. Why it can be compiled?
#[derive(Debug)]
struct X {
a: i32,
b: i32,
}
let y;
y = &X { a: 1, b: 2 }; // Why didn't it break E0716?
println!("{:?}", y);
or
#[derive(Debug)]
struct X {
a: i32,
b: i32,
}
let y;
{
y = &X { a: 1, b: 2 };
}
println!("{:?}", y);