-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Stabilize Index traits and most range notation #21258
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
@alexcrichton BTW, I didn't deprecate the |
|
||
range_other_impls!(uint u8 u16 u32 u64 int i8 i16 i32 i64); |
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.
Shouldn't i64/u64 not get ExactSizeIterator
on 32-bit platforms? (due to range_impl_no_hint
above)
This sounds fantastic! |
Does this close #19148 ? |
Sure, why not! I've marked it as such and I'll open a separate ticket for the remaining prelude and renaming issue. |
r=me with the |
Will taking by-reference have a poor interaction with IndexSet (which should be by-val, I think)? |
cc49f5a
to
c6db309
Compare
@gankro No, |
@bors: r=alexcrichton 0ee5f82 |
⌛ Testing commit 0ee5f82 with merge 74a7fd9... |
💔 Test failed - auto-win-64-nopt-t |
This commit marks as `#[stable]`: * The `Index` and `IndexMut` traits. These are stabilized as taking the index itself *by reference*; after extensive discussion it was determined that this is a better match with our choices elsewhere (e.g. making comparison operators auto-reference), and that the use cases for by-value indices are better handled through `IndexSet`. * The `Range`, `RangeFrom` and `RangeTo` structs, introduced for range notation. * Various impls of `Index` and `IndexMut`. The `FullRange` struct is left unstable as we may wish to rename it to `RangeFull` in the future. This commit also *removes* the `Step` trait in favor of direct implementation of iterator traits on ranges for integers. The `Step` trait was not a terribly useful factoring internally, and it is likely that external integer types are best off implementing range iterators directly. It was removed to simplify the API surface. We can always reintroduce `Step` later if it turns out to be useful. Due to this removal, this is a: [breaking-change]
This commit deprecates `slice`, `slice_from`, `slice_to` and their mutable variants in favor of slice notation. The `as_slice` methods are left intact, for now. [breaking-change]
@bors: r=alexcrichton 0fc3e8a |
@bors: r- |
⌛ Testing commit da8023d with merge 29ae8d6... |
💔 Test failed - auto-mac-64-opt |
Conflicts: src/libcore/ops.rs src/librustc_typeck/astconv.rs src/libstd/io/mem.rs src/libsyntax/parse/lexer/mod.rs
This PR marks as
#[stable]
:Index
andIndexMut
traits. These are stabilized as taking theindex itself by reference; after extensive discussion it was
determined that this is a better match with our choices
elsewhere (e.g. making comparison operators auto-reference), and that
the use cases for by-value indices are better handled through
IndexSet
.Range
,RangeFrom
andRangeTo
structs, introduced for rangenotation.
Index
andIndexMut
.The
FullRange
struct is left unstable as we may wish to rename it toRangeFull
in the future.This PR also deprecates
slice
,slice_from
,slice_to
and theirmutable variants in favor of slice notation.
The
as_slice
methods are left intact, for now.This PR also removes the
Step
trait in favor of directimplementation of iterator traits on ranges for integers. The
Step
trait was not a terribly useful factoring internally, and it is likely
that external integer types are best off implementing range iterators
directly. It was removed to simplify the API surface. We can always
reintroduce
Step
later if it turns out to be useful.Due to this removal, this is a:
[breaking-change]
Closes #19148
Closes #20981