Closed
Description
Uninitialized fixed size arrays always throw Use of possibly uninitialized variable
errors, even if all the indices are allocated. Is there a way around this? If not, it shouldn't be possible to create uninitialized fixed size arrays.
struct Num {s: int}
fn main() {
let s = box Num {s: 5};
let mut a: [&Num, ..5];
a[0] = &*s; a[1] = &*s; a[2] = &*s; a[3] = &*s; a[4] = &*s;
println!("{}", a[0].s) // error: use of possibly uninitialized variable: `a[..].s`
}
Metadata
Metadata
Assignees
Labels
No labels