Closed
Description
I tried to run this code:
fn main() {
let vec = vec![1, 2, 3, 4];
for i in 0..vec.len() {
for b in vec.windows(i) {
// Do stuff
}
}
}
Of course this shouldn't work since you can't create windows that have 0 elements, but the problem is with the runtime error. It just panicks with this err:
thread 'main' panicked at 'size is zero', /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/slice/mod.rs:786:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
And it is very unclear where was the mistake.