Skip to content
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

Merged
merged 3 commits into from
Sep 14, 2018

Conversation

weiznich
Copy link
Contributor

@weiznich weiznich commented Aug 9, 2018

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)

@rust-highfive
Copy link
Collaborator

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 9, 2018
@kennytm kennytm added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. relnotes Marks issues that should be documented in the release notes of the next release. labels Aug 9, 2018
@rust-highfive

This comment has been minimized.

@@ -1064,6 +1064,12 @@ impl<T> From<T> for Option<T> {
}
}

impl<'a, T> From<&'a Option<T>> for Option<&'a T> {
Copy link
Member

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.

@clarfonthey
Copy link
Contributor

Could you add a mutable version too? Awesome job!

@KodrAus
Copy link
Contributor

KodrAus commented Aug 12, 2018

Thanks @weiznich! I think we'll need to do a crater run for this, because new impl block added to the standard library tend to break inference in the ecosystem in weird and wonderful ways.

@kennytm
Copy link
Member

kennytm commented Aug 12, 2018

@bors try for crater

cc @rust-lang/infra

@bors
Copy link
Contributor

bors commented Aug 12, 2018

⌛ Trying commit a7a0225 with merge bd6b537506d0e5e33051e42212b7027581b59a00...

@kennytm kennytm added the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Aug 12, 2018
@bors
Copy link
Contributor

bors commented Aug 12, 2018

💔 Test failed - status-travis

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 12, 2018
@rust-highfive

This comment has been minimized.

@kennytm
Copy link
Member

kennytm commented Aug 12, 2018

@bors retry

@bors
Copy link
Contributor

bors commented Aug 12, 2018

⌛ Trying commit a7a0225 with merge 8bad4898151ee6feab25a9544d51f1863602172a...

@bors
Copy link
Contributor

bors commented Aug 12, 2018

☀️ Test successful - status-travis
State: approved= try=True

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 12, 2018
@weiznich
Copy link
Contributor Author

The bors build was successful. Who is responsible for triggering the crater run?

@weiznich
Copy link
Contributor Author

@KodrAus @kennytm Any news about the crater run?

@rfcbot
Copy link

rfcbot commented Aug 25, 2018

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.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Aug 25, 2018
@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Sep 3, 2018
@rfcbot
Copy link

rfcbot commented Sep 3, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Sep 3, 2018
@TimNN TimNN added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 11, 2018
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Sep 13, 2018
@rfcbot
Copy link

rfcbot commented Sep 13, 2018

The final comment period, with a disposition to merge, as per the review above, is now complete.

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Sep 13, 2018
src/libcore/option.rs Show resolved Hide resolved
@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 13, 2018
@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 14, 2018
@kennytm
Copy link
Member

kennytm commented Sep 14, 2018

So would anyone from @rust-lang/libs wanna r+ before the actual branch off? 👀

@KodrAus
Copy link
Contributor

KodrAus commented Sep 14, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Sep 14, 2018

📌 Commit a7a0225 has been approved by KodrAus

@bors bors 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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 14, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Sep 14, 2018
…=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)
bors added a commit that referenced this pull request Sep 14, 2018
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
@bors
Copy link
Contributor

bors commented Sep 14, 2018

⌛ Testing commit a7a0225 with merge fccde00...

@bors bors merged commit a7a0225 into rust-lang:master Sep 14, 2018
@Centril Centril added this to the 1.31 milestone Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.