stabilize new RangeFrom type and iterator#153380
stabilize new RangeFrom type and iterator#153380pitaj wants to merge 2 commits intorust-lang:mainfrom
Conversation
stabilizes `core::range::RangeFrom` stabilizes `core::range::RangeFromIter`
This comment was marked as resolved.
This comment was marked as resolved.
| /// *Note*: Overflow in the [`Iterator`] implementation (when the contained | ||
| /// *Note*: Overflow in the [`IntoIterator`] implementation (when the contained | ||
| /// data type reaches its numerical limit) is allowed to panic, wrap, or | ||
| /// saturate. This behavior is defined by the implementation of the [`Step`] | ||
| /// trait. For primitive integers, this follows the normal rules, and respects | ||
| /// the overflow checks profile (panic in debug, wrap in release). Note also | ||
| /// that overflow happens earlier than you might assume: the overflow happens | ||
| /// in the call to `next` that yields the maximum value, as the range must be | ||
| /// set to a state to yield the next value. | ||
| /// the overflow checks profile (panic in debug, wrap in release). Unlike | ||
| /// its legacy counterpart, the iterator will only panic after yielding the | ||
| /// maximum value when overflow checks are enabled. |
There was a problem hiding this comment.
Do we have a test for this?
There was a problem hiding this comment.
Yes: rangefrom-overflow-overflow-checks and friends
| /// Returns the remainder of the range being iterated over. | ||
| #[inline] | ||
| #[rustc_inherit_overflow_checks] | ||
| #[unstable(feature = "new_range_api", issue = "125687")] | ||
| #[stable(feature = "new_range_from_api", since = "CURRENT_RUSTC_VERSION")] | ||
| pub fn remainder(self) -> RangeFrom<A> { |
There was a problem hiding this comment.
This could probably use an example
There was a problem hiding this comment.
Added examples for RangeInclusive::remainder, RangeFrom::remainder, and Range::remainder
|
It doesn't look like @rustbot label +I-libs-api-nominated The current |
|
Noticing that |
|
|
|
☔ The latest upstream changes (presumably #153544) made this pull request unmergeable. Please resolve the merge conflicts. |
Tracking issue: #125687
r? tgross