safe ref checker permits vectors to be freed as they are being iterated over #1925
Closed
Description
Running this program:
use std;
import std::io;
fn iter(&&v: [uint], f: fn(uint)) {
for i in v { f(i) }
}
fn main(args: [str]) {
let v = vec::enum_uints(0u, 10u);
iter(v) { |i|
v = [];
io::print(#fmt["i=%?\n", i]);
}
}
yields this output
i=0
i=2
i=171048973
i=1979117988610105
i=4122818071364057393
i=3978138846657458487
i=3979273541751617588
i=51
i=17293822612877934602
i=17293822569102704640
i=9
I expected a compile error.