Consider this Rust program:
fn main() {
let mut z : Vec<Vec<(bool,f64)>> = Vec::with_capacity(10);
unsafe { z.set_len(10); }
z[0] = vec!((true,1.));
println!("{:?}", z[0]);
}
https://play.rust-lang.org/?gist=ccf387ed66a0d8b832ed&version=stable
Rust should attempt to drop z[0]
when we set it, and since z[0]
is uninitialized it should crash the program. However, it runs fine. Why?