Closed
Description
fn main() {
let v: &[int] = &[1i];
let mut it = v.rev_iter();
// println(fmt!("%?", (it.next(), it.next(), it.next(), it.next(), it.next(), )))
let res = it.collect::<~[&int]>();
// let mut res = ~[]; for it.advance |x| { res.push(x); }
println(fmt!("%?", res));
}
$ ./rev-iter
*** Error in `./rev-iter': malloc(): memory corruption (fast): 0x00007f46cc201a70 ***
^C
(It hangs at lock_and_signal::wait (this=this@entry=0x610ed0) at /home/huon/rust/src/rt/sync/lock_and_signal.cpp:115
.)
Either of the commented-out lines (after removing the .collect
call) work fine so it doesn't appear to be caused by .rev_iter
being entirely wrong. Significantly, the let mut res = ...
line is actually essentially identical to what the .collect
call is doing.
Metadata
Metadata
Assignees
Labels
No labels