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
Rollup merge of rust-lang#148703 - pitaj:rangefrom-overflow_checks, r=Mark-Simulacrum
Use `overflow_checks` intrinsic so `IterRangeFrom` yields MAX before panicking in debug
Based on rust-lang#128666. For your convenience, here is the [diff from that PR](pitaj/rust@intrinsic-overflow_checks...pitaj:rust:rangefrom-overflow_checks).
When `overflow_checks` are enabled, the following code will output as shown
```rust
for n in std::range::RangeFrom::from(253_u8..) {
println!("{n}");
}
// 253
// 254
// 255
// panic
```
Which is a change from the current behavior, where it will panic after printing 254.
This behavior was [requested by the libs team](rust-lang#125687 (comment))
r? `@Mark-Simulacrum`
0 commit comments