-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove prelude dependency for range notation; rename FullRange #21263
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
Comments
cc @nick29581 Nominating for 1.0 beta, P-backcompat-lang. |
As far as I see it, there are two options: we either put For most users the two approaches are identical. Not having anything in the prelude is an advantage of the second approach. The difference is for users who aren't using the prelude. Off the bat, the former approach does not work, and the latter one does (assuming they are using libcore). If they are not using libcore, then under the second approach, they are screwed (they could I guess create their own lib called Without a prelude, users would have to provide a Finally, there is the overriding case. The first approach allows users to override On balance, it seems that the second approach is slightly better, the only people it really sucks for are those running without libcore. Do we expect that to be a sizeable group or not? |
And another thought: approach 2 is easier to future proof - I'm not exactly clear on how the stability stuff would work here, but could we mark Perhaps, even if we mark it stable, we could still change to using a lang item in the future without breaking anyone's code, so it is backwards compatible? Whereas approach 1 would be backwards incompatible because users could rely on it being in the prelude. |
I think using |
@nick29581 I pretty much agree with your thinking here -- it should be a lang item in the long run, but welding it to a path for now should allow us to future-proof that change. (And no-core scenarios are not considered stable anyway). (I think running without core is very unusual, because core imposes so few constraints.) We do need to stabilize the various structs so that people can provide custom impls of traits for them, and so on. But I agree that making it a lang item should be a fine change, especially since no-core is not considered stable. |
I agree that an absolute path is the best way forward for now. |
1.0 beta, P-backcompat-libs |
So, I implemented this (expand to Any other ideas? |
We should stick to expanding to |
@alexcrichton this would break a lot of code in libcore and libcollections - nothing there will be able to use full range slicing syntax (including the proposed standalone |
That's typically worked around with the "curious inner module" hack via: #![no_std]
extern crate core;
mod std {
pub use core::ops;
} |
As per rust-lang/rust#21263, `FullRange` got renamed to `RangeFull`.
The range notation currently desugars directly to uses of e.g.
RangeFrom
and requires these structs to be present in the prelude.In addition, the
FullRange
struct should probably be calledRangeFull
for conventions/consistency.The text was updated successfully, but these errors were encountered: