Add Cow -> Box impls. by clarfonthey · Pull Request #44466 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation8 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Considering how impls exist for String
and &str
, it makes sense to also add an impl for Cow<str>
as well.
This would allow converting String::from_utf8_lossy
directly into a Box<Error>
or io::Error
without having to add an extra into_ownd()
.
(rust_highfive has picked a reviewer for you, use r? to override)
alexcrichton added the T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
label
Seems reasonable to me
@rfcbot fcp merge
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams:
No concerns currently listed.
Once these reviewers reach consensus, 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.
@@ -217,6 +217,20 @@ impl<'a> From<&'a str> for Box { |
---|
} |
} |
#[stable(feature = "cow_box_error", since = "1.22.0")] |
impl<'a, 'b> From<Cow<'b, str>> for Box<Error + Send + Sync + 'a> { |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to import Cow
.
[00:03:22] error[E0412]: cannot find type Cow
in this scope
[00:03:22] --> /checkout/src/libstd/error.rs:221:19
[00:03:22] |
[00:03:22] 221 | impl<'a, 'b> From<Cow<'b, str>> for Box<Error + Send + Sync + 'a> {
[00:03:22] | ^^^ not found in this scope
[00:03:22] |
[00:03:22] help: possible candidate is found in another module, you can import it into scope
[00:03:22] |
[00:03:22] 66 | use alloc::borrow::Cow;
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a silly error. Fixed.
🔔 This is now entering its final comment period, as per the review above. 🔔
📌 Commit 778d5f2 has been approved by alexcrichton
aidanhs added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-team
Status: Awaiting decision from the relevant subteam (see the T- label).
labels
alexcrichton added a commit to alexcrichton/rust that referenced this pull request
Add Cow -> Box impls.
Considering how impls exist for String
and &str
, it makes sense to also add an impl for Cow<str>
as well.
This would allow converting String::from_utf8_lossy
directly into a Box<Error>
or io::Error
without having to add an extra into_ownd()
.
bors added a commit that referenced this pull request
alexcrichton added a commit to alexcrichton/rust that referenced this pull request
Add Cow -> Box impls.
Considering how impls exist for String
and &str
, it makes sense to also add an impl for Cow<str>
as well.
This would allow converting String::from_utf8_lossy
directly into a Box<Error>
or io::Error
without having to add an extra into_ownd()
.
bors added a commit that referenced this pull request
Rollup of 11 pull requests
- Successful merges: #44364, #44466, #44537, #44548, #44640, #44651, #44657, #44661, #44668, #44671, #44675
- Failed merges:
Labels
In the final comment period and will be merged soon unless new substantive objections are raised.
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the library API team, which will review and decide on the PR/issue.