-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
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.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.