-
Couldn't load subscription status.
- Fork 13.9k
Add FromIterator impls for ascii::Chars to Strings
#141445
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
Add FromIterator impls for ascii::Chars to Strings
#141445
Conversation
This comment has been minimized.
This comment has been minimized.
4e9a021 to
8365332
Compare
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.
Makes complete sense to me! This will need T-libs-api approval though...
Implementation-wise, I think it'd be good to go through Vec's FromIterator implementation. That way we get to take advantage of all of its nice specialisations...
r? libs-api
8365332 to
8569bb2
Compare
|
Hey, @joshtriplett , friendly ping :) I'd love to get this looked at! Thank you 🙏 |
|
Triage: Re-rolling reviewer. r? libs-api |
|
Friendly ping to new reviewer @the8472 , thanks! |
|
Re-shuffling reviewer again :) |
|
For future reference, it's often a good idea to create an ACP if you want libs-api's attention. But I'll nominate this so someone sees it. I would only note that adding traits can sometimes be more fraught than it may appear (e.g. it can unexpectedly break crates due to inference failures, etc) but I think this should be fine seeing as |
Thanks. I was under the misconceived notion that adding trait impls on top of an unstable API didn't warrant an ACP :) |
|
For sure. |
|
We discussed this during today's libs-api meeting. Since Char is still unstable we're ok with adding this for now and review it later during stabilization. @bors r=the8472,joshtriplett As followup it could also be added to |
Rollup of 7 pull requests Successful merges: - #141445 (Add `FromIterator` impls for `ascii::Char`s to `String`s) - #142339 (Add NonNull pattern types) - #147768 (Code refactoring on hir report_no_match_method_error) - #147788 (const Cell methods) - #147932 (Create UTF-8 version of `OsStr`/`OsString`) - #147933 (os_str: Make platform docs more consistent) - #147948 (PassWrapper: Access GlobalValueSummaryInfo::SummaryList via getter for LLVM 22+) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - rust-lang/rust#141445 (Add `FromIterator` impls for `ascii::Char`s to `String`s) - rust-lang/rust#142339 (Add NonNull pattern types) - rust-lang/rust#147768 (Code refactoring on hir report_no_match_method_error) - rust-lang/rust#147788 (const Cell methods) - rust-lang/rust#147932 (Create UTF-8 version of `OsStr`/`OsString`) - rust-lang/rust#147933 (os_str: Make platform docs more consistent) - rust-lang/rust#147948 (PassWrapper: Access GlobalValueSummaryInfo::SummaryList via getter for LLVM 22+) r? `@ghost` `@rustbot` modify labels: rollup
Wanted to
collectascii chars into aStringwhile working on #141369 , and was surprised these impls don't exist. Seems to me to be simply oversight.BTW, I only added
impl FromIterator<ascii::Char> for Cow<'_, str>, without a correspondingFromIterator<&Char>impl, because there's no existing impl forFromIterator<&char>, but that might be oversight too.cc #110998