-
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
impl FromIterator<char> for Box<str> #70094
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
73ea386
to
5500fcd
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.
This seems like a reasonable addition to me. Thanks!
Please add four tests for the other four impls. And see my inline comment on the test.
These are analogous to impl FromIterator<A> for Box<[A]> (rust-lang#55843). Fixes rust-lang#65163. Signed-off-by: Anders Kaseorg <[email protected]>
26e3e08
to
e355419
Compare
Sure, now all five |
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.
Looks good to me!
This PR adds the following stable impls:
All these impls already exist for As I cannot start FCP merges, reassigning. |
r? @Amanieu |
Note: I saw in #40028 that @withoutboats regretted that the five |
You should send in a PR to https://github.com/rust-lang/team to fix that btw. :) |
@rfcbot fcp merge |
Team member @Amanieu has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
I am not enthusiastic about this addition. I would prefer not to go any more in the direction of making Box<str> a fully fledged string type. I see it as a niche alternative representation for owned strings for use cases in which 2 words of size instead of 3 words matters for memory usage, such as a big intern table. In general I'd like users to reach for String when operating with owned strings, and use into_boxed_str if their use case demands the representation of a boxed str. I'm fine with the necessary APIs for Box<str> as a niche string representation, including things like From<String> and Default. I'm less fine with growing more string-related surface area around Box<str> than that, like FromIterator, Extend, Add, etc. If someone wants to collect into an owned string and use Box<str> as the representation, I think it's fine to have them write @rfcbot concern is Box<str> a string or a niche string representation |
☔ The latest upstream changes (presumably #70362) made this pull request unmergeable. Please resolve the merge conflicts. |
I don't know whether procedurally I should fcp close, but I see a 👍 on #70094 (comment) from Lukas who originally proposed the fcp and it doesn't seem like people are planning to make the opposite case so I'll go ahead and directly close the PR. We can reopen as needed if someone is interested in sticking up for the opposite point of view. Thanks anyway @andersk! |
This is analogous to
impl FromIterator<A> for Box<[A]>
(#55843).Fixes #65163.