You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would argue that the following code is safe (rustc presently disagrees: "error: use of possibly uninitialized variable: a") and there should be a way to write it:
fn main(){
let a: int;
let b: *int = &a;
}
The analysis is correct in that obtaining an &-ptr to an uninitialized variable allows for unsafety, but there should be a way to get the address of a variable as a raw-ptr without needing a guarantee that a valid value lives at that address.