-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
FromIterator and Extend Cow for String #41449
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@Eh2406 can you respond to the comment on the linked issue? Why not |
On the stability attributes: Trait impls are (unfortunately) still insta-stable, they ignore stability attributes. Edit: oh, and it would really need to be |
I'd love to use the more generic version. It will replace all existing impls. Do we just throw out the stability feature and versions? |
char can not impl Borrow thus the generic does not cover existing stable uses, but rust does not know that it will never impl it so it won't let us have the generic and the specific. // proposed generic version
impl<T: Borrow<str>> FromIterator<T> for String {}
// existing impls
impl<'a> FromIterator<&'a str> for String {...} // remove, covered by generic
impl FromIterator<String> for String {...} // remove, covered by generic
impl FromIterator<char> for String {...} // not covered nor compatible with generic |
and if I remove the impls for char it corectly points out that the trait |
hmm, that is a shame about the conflicts. Can specialization be used here to allow this? (And I suppose the follow up is: do we want to use specialization for this case). |
conflicting implementations but this is my ferst use of specialization. Did I use it wrong? I have bean testing in other prs so that this direct version says mergeable. |
Specialization can't be used to tackle this problem, because The core problem is as @Eh2406 identified, which is that Rust is trying to defend against a future where I think this is the best we can do for the time being. Can you update the version numbers on the stability attributes, to 1.19? Otherwise, r=me. |
Fixed, rebased, and squashed. |
Thanks! @bors: r+ rollup |
📌 Commit 0e2571b has been approved by |
FromIterator and Extend Cow for String This is a quick draft to start working on [rust-lang#41351](rust-lang#41351). I don't think I got the stable attributes correct, but it is good enuf to start a conversation.
FromIterator and Extend Cow for String This is a quick draft to start working on [rust-lang#41351](rust-lang#41351). I don't think I got the stable attributes correct, but it is good enuf to start a conversation.
FromIterator and Extend Cow for String This is a quick draft to start working on [rust-lang#41351](rust-lang#41351). I don't think I got the stable attributes correct, but it is good enuf to start a conversation.
497: impl FromParallelIterator<()> for () r=cuviper a=cuviper This is more useful when combined with higher-level abstractions, like collecting to a `Result<(), E>` where you only care about errors. This is a parallel version of rust-lang/rust#45379. Cc #496 498: FromParallelIterator and ParallelExtend Cow for String r=cuviper a=cuviper Parallel version of rust-lang/rust#41449.
498: FromParallelIterator and ParallelExtend Cow for String r=cuviper a=cuviper Parallel version of rust-lang/rust#41449.
498: FromParallelIterator and ParallelExtend Cow for String r=cuviper a=cuviper Parallel version of rust-lang/rust#41449.
This is a quick draft to start working on #41351.
I don't think I got the stable attributes correct, but it is good enuf to start a conversation.