-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Stabilize new inclusive range type and iterator type #150522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
stabilizes `core::range::RangeInclusive` and `core::range::RangeInclusiveIter`
|
r? libs-api |
| #[unstable(feature = "new_range_api", issue = "125687")] | ||
| pub use iter::{RangeFromIter, RangeIter}; | ||
|
|
||
| // FIXME: re-exports temporarily removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: FIXME(#125687) keeps things greppable (ditto for the FIXMEs in the tests)
| #[unstable(feature = "new_range_api", issue = "125687")] | ||
| #[stable(feature = "new_rangeinclusive_api", since = "CURRENT_RUSTC_VERSION")] | ||
| pub struct RangeInclusive<Idx> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional nit: the camel->snake conversion from RangeInclusive would be range_inclusive rather than rangeinclusive
| /// # Examples | ||
| /// | ||
| /// ``` | ||
| /// #![feature(new_range_api)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be dropped from the doctests on stabilized API
|
Reminder, once the PR becomes ready for a review, use |
| #[unstable(feature = "new_range_api", issue = "125687")] | ||
| #[stable(feature = "new_rangeinclusive_api", since = "CURRENT_RUSTC_VERSION")] | ||
| #[inline] | ||
| #[rustc_const_unstable(feature = "const_range", issue = "none")] | ||
| pub const fn is_empty(&self) -> bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshtriplett in the FCP proposal said
(Note that this doesn't include the
is_emptymethod.)
I'm not sure what the context is, but should it be dropped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is_empty is fine; we checked in the libs-api meeting, and we're pretty sure that comment was referring to the unstable method on RangeBounds, which we should not stabilize.
|
I added an API summary of what is stabilized here to the top post, nominating for @rust-lang/libs-api to double check and nudge the FCP. There is an ongoing proposed FCP at #125687 (comment), but maybe it makes sense to restart it here with smaller scope? Everything seems to match up with the traits available on Two small concerns found from digging around the issue and other discussion:
@rustbot label +I-libs-api-nominated |
TBH, I never thought "start" and "end" went together either. A race is start-to-finish where you place somewhere in first..=last; a story commonly has a beginning, middle, and end. Are any of those better enough to bother changing something? Dunno. |
When I suggested changing |
|
We discussed the field names in the @rust-lang/libs-api meeting and were inclined to keep them as they currently are. |
|
As they currently are in this PR, or as they currently are on the old RangeInclusive types? |
I believe as they are in this PR. From the meeting notes at https://hackmd.io/_EpeHNVySbqHWCSqXwLX1w#nominated-rusttf150522-Stabilize-new-inclusive-range-type-and-iterator-type
And no different names mentioned. |
Part 1 of stabilizing the new range types for #125687
stabilizes
core::range::RangeInclusiveandcore::range::RangeInclusiveIter. Newly stable API:I've removed the re-exports temporarily because from what I can tell, there's no way to make re-exports of stable items unstable. They will be added back and stabilized in a separate PR.