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
Version: stable (1.41.0), but panic also occurs on nightly (1.43.0-nightly (2020-02-10 e6ec0d1))
Backtrace
... snip ...
13: core::panicking::panic
at src/libcore/panicking.rs:52
14: <i32 as core::ops::arith::Add>::add
at /rustc/e6ec0d125eba4074122b187032474b4174fb9d31/src/libcore/ops/arith.rs:94
15: <i32 as core::iter::range::Step>::add_one
at /rustc/e6ec0d125eba4074122b187032474b4174fb9d31/src/libcore/iter/range.rs:67
16: core::iter::range::<impl core::iter::traits::iterator::Iterator for core::ops::range::RangeFrom<A>>::next
at /rustc/e6ec0d125eba4074122b187032474b4174fb9d31/src/libcore/iter/range.rs:314
17: playground::main
at src/main.rs:2
... snip ...
The text was updated successfully, but these errors were encountered:
The RangeFrom docs specify that it will currently panic in debug mode, and that this behavior is subject to change.
I'm not sure how intentional it is that the last value is left out, but given that RangeFrom only has a start field, it can't currently represent the state of just having returned the maximum value from next.
I tried this code:
I expected to see this happen: The numbers
2147483646
and2147483647
should be printed, then the program should exit.Instead, this happened: The standard library panicked.
Note that it might make sense to panic on overflow instead, but at least 2147483647 should printed first, since it's within the range of
i32
.Playground
Meta
Version: stable (1.41.0), but panic also occurs on nightly (1.43.0-nightly (2020-02-10 e6ec0d1))
Backtrace
The text was updated successfully, but these errors were encountered: