You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnmain(){let vec = vec![1,2,3,4];for i in0..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.
The text was updated successfully, but these errors were encountered:
improve panic message for slice windows and chunks
before:
```text
thread 'main' panicked at 'size is zero', /rustc/1e225413a21fa69570bd3fefea9eb05e33f8b917/library/core/src/slice/mod.rs:809:44
```
```text
thread 'main' panicked at 'assertion failed: `(left != right)`
left: `0`,
right: `0`: chunks cannot have a size of zero', /rustc/1e225413a21fa69570bd3fefea9eb05e33f8b917/library/core/src/slice/mod.rs:843:9
```
after:
```text
thread 'main' panicked at 'chunk size must be non-zero', src/main.rs:4:22
```
fixesrust-lang/rust#107437
I tried to run this code:
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:
And it is very unclear where was the mistake.
The text was updated successfully, but these errors were encountered: