-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Prelude: rename and consolidate extension traits #18559
Conversation
#[doc(no_inline)] pub use str::{Str, StrVector, StrSlice}; | ||
#[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrSlice}; | ||
#[doc(no_inline)] pub use str::{Str, StrVector, StrPrelude}; | ||
#[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrPrelude}; |
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.
Would this be a good time to consolidate Str
and StrPrelude
? (or can we not do that?)
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.
People are definitely using Str
for generics in libraries (for better or worse), so I don't want to lose it until we have a more general replacement (which I have some thoughts about, but for a different PR.)
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.
Ah yes, good point!
Love seeing |
pub trait MutableSliceAllocating<T> for Sized? { | ||
/// Allocating extension methods for slices on Ord values. | ||
#[experimental = "likely to merge with other traits"] | ||
pub trait OrdSliceAllocPrelude<T> for Sized? { |
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.
I wonder, could this be called OrdSlicePrelude
, and then we could use modules/renaming to import both this and the libcore version into the prelude?
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.
That may not help the docs, however.
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.
Yeah, so this is why I was thinking it might be nice for std
to just define its own set of extension traits that hook into the underlying traits from core
etc. I can't see a way to do that without duplicating the docs, though :-/
091700c
to
ca1ba39
Compare
Pushed a fix for some of your changes, but looks like at least one of my comments got lost. I definitely agree that the names here are... terrible... but that's a little intentional (e.g with the That said, generalized Let me know whether you prefer the strategy I've taken here, or something with more concise names and where |
@alexcrichton Oh, the other comment that got eaten: the story with |
Sounds good to me, r=me with a rebase. |
We can discuss pursuing more aggressive options later, but this is certainly a good step forward |
e6ff48a
to
8db009e
Compare
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses. The renamings are consistent with the [new `-Prelude` suffix](rust-lang/rfcs#344). There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules. Because this renames traits, it is a: [breaking-change] However, I do not expect any code that currently uses the standard library to actually break. Closes rust-lang#17917
8db009e
to
cfafc1b
Compare
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses. The renamings are consistent with the [new `-Prelude` suffix](rust-lang/rfcs#344). There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules. Because this renames traits, it is a: [breaking-change] However, I do not expect any code that currently uses the standard library to actually break. Closes #17917
I pushed this manually because all tests passed and @bors is having a tough time catching up. |
fix: Fix a stack overflow when computing the sizedness of a struct that includes itself as the tail field
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses.
The renamings are consistent with the new
-Prelude
suffix. There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules.Because this renames traits, it is a:
[breaking-change]
However, I do not expect any code that currently uses the standard library to actually break.
Closes #17917