Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels