-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement From for more types on Cow #50170
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @KodrAus (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. |
Thanks @burtonageo! At first glance this looks good to me, there are a few more concrete implementations like
These probably aren't strictly necessary, but the |
|
Thanks @burtonageo! This looks good to me. @rfcbot fcp merge These conversions are insta-stable, but I don't think they're contentious. We now have a pattern with our
This brings our set of impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
impl<'a, T> From<&'a [T]> for Cow<'a, [T]>
impl<'a, T> From<Vec<T>> for Cow<'a, [T]>
+ impl<'a, T> From<&'a Vec<T>> for Cow<'a, [T]>
impl<'a> From<Cow<'a, str>> for String
impl<'a> From<&'a str> for Cow<'a, str>
impl<'a> From<String> for Cow<'a, str>
+ impl<'a> From<&'a String> for Cow<'a, str>
+ impl<'a> From<Cow<'a, Path>> for PathBuf
impl<'a> From<&'a Path> for Cow<'a, Path>
impl<'a> From<PathBuf> for Cow<'a, Path>
+ impl<'a> From<&'a PathBuf> for Cow<'a, Path>
+ impl<'a> From<Cow<'a, CStr>> for CString
+ impl<'a> From<&'a CStr> for Cow<'a, CStr>
+ impl<'a> From<CString> for Cow<'a, CStr>
+ impl<'a> From<&'a CString> for Cow<'a, CStr>
+ impl<'a> From<Cow<'a, OsStr>> for OsString
+ impl<'a> From<&'a OsStr> for Cow<'a, OsStr>
+ impl<'a> From<OsString> for Cow<'a, OsStr>
+ impl<'a> From<&'a OsString> for Cow<'a, OsStr> |
@rfcbot fcp merge |
One more time... @rfcbot fcp merge |
@rfcbot we are no longer friends. I could just r+ this but figured I'd use rfcbot since these impls won't have an unstable period. cc @rust-lang/libs |
@rfcbot fcp merge |
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), 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. |
src/liballoc/string.rs
Outdated
@@ -2239,6 +2239,14 @@ impl<'a> From<String> for Cow<'a, str> { | |||
} | |||
} | |||
|
|||
#[stable(feature = "cow_from_string_ref", since = "1.27.0")] |
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.
These should all become 1.28.0
@KodrAus Can this now enter final comment period? |
It needs one more vote from either @Kimundi, @aturon or @withoutboats. |
Ping, @Kimundi, @aturon or @withoutboats: This PR has an open FCP request that needs your input. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@bors: r+ |
📌 Commit 7c0f664 has been approved by |
…chton Implement From for more types on Cow This is basically rust-lang#48191, except that it should be implemented in a way that doesn't break third party crates.
Rollup of 17 pull requests Successful merges: - #50170 (Implement From for more types on Cow) - #50638 (Don't unconditionally set CLOEXEC twice on every fd we open on Linux) - #50656 (Fix `fn main() -> impl Trait` for non-`Termination` trait) - #50669 (rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`) - #50726 (read2: Use inner function instead of closure) - #50728 (Fix rustdoc panic with `impl Trait` in type parameters) - #50736 (env: remove unwrap in examples in favor of try op) - #50740 (Remove LazyBTreeMap.) - #50752 (Add missing error codes in libsyntax-ext asm) - #50779 (Make mutable_noalias and arg_align_attributes be tracked) - #50787 (Fix run-make wasm tests) - #50788 (Fix an ICE when casting a nonexistent const) - #50789 (Ensure libraries built in stage0 have unique metadata) - #50793 (tidy: Add a check for empty UI test files) - #50797 (fix a typo in signed-integer::from_str_radix()) - #50808 (Stabilize num::NonZeroU*) - #50809 (GitHub: Stop treating Cargo.lock as a generated file.) Failed merges:
This PR did still cause breakage: #51844 |
This is basically #48191, except that it should be implemented in a way that doesn't break third party crates.