-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 a implementation of From
for converting &'a Option<T>
into Option<&'a T>
#53218
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. |
This comment has been minimized.
This comment has been minimized.
src/libcore/option.rs
Outdated
@@ -1064,6 +1064,12 @@ impl<T> From<T> for Option<T> { | |||
} | |||
} | |||
|
|||
impl<'a, T> From<&'a Option<T>> for Option<&'a T> { |
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.
I'm not sure if any annotations regarding the stabilization are needed
Yes this needs to be #[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
. (The feature name can be anything unique). This is going to be insta-stable.
Could you add a mutable version too? Awesome job! |
Thanks @weiznich! I think we'll need to do a crater run for this, because new |
@bors try for crater cc @rust-lang/infra |
⌛ Trying commit a7a0225 with merge bd6b537506d0e5e33051e42212b7027581b59a00... |
💔 Test failed - status-travis |
This comment has been minimized.
This comment has been minimized.
@bors retry |
⌛ Trying commit a7a0225 with merge 8bad4898151ee6feab25a9544d51f1863602172a... |
☀️ Test successful - status-travis |
The bors build was successful. Who is responsible for triggering the crater run? |
Team member @dtolnay 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. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. |
So would anyone from @rust-lang/libs wanna r+ before the actual branch off? 👀 |
@bors r+ |
📌 Commit a7a0225 has been approved by |
…=KodrAus Add a implementation of `From` for converting `&'a Option<T>` into `Option<&'a T>` I'm not sure if any annotations regarding the stabilization are needed or in general what's the correct process of adding such an impl. cc @sgrif (We have talked about this)
Rollup of 8 pull requests Successful merges: - #53218 (Add a implementation of `From` for converting `&'a Option<T>` into `Option<&'a T>`) - #54024 (Fix compiling some rustc crates to wasm) - #54095 (Rename all mentions of `nil` to `unit`) - #54173 (Suggest valid crate type if invalid crate type is found) - #54194 (Remove println!() statement from HashMap unit test) - #54203 (Fix the stable release of os_str_str_ref_eq) - #54207 (re-mark the never docs as unstable) - #54210 (Update Cargo) Failed merges: r? @ghost
I'm not sure if any annotations regarding the stabilization are needed or in general what's the correct process of adding such an impl.
cc @sgrif (We have talked about this)