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

Stabilize Result::as_deref and as_deref_mut #74948

Merged
merged 3 commits into from
Aug 3, 2020

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Jul 30, 2020

FCP completed in #50264 (comment).

This PR stabilizes two methods for std::result::Result:

fn as_deref(&self) -> Result<&T::Target, &E> where T: Deref;
fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> where T: DerefMut;

This PR also removes two rarely used unstable methods from Result:

fn as_deref_err(&self) -> Result<&T, &E::Target> where E: Deref;
fn as_deref_mut_err(&mut self) -> Result<&mut T, &mut E::Target> where E: DerefMut;

Closes #50264

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 30, 2020
@jonas-schievink jonas-schievink added relnotes Marks issues that should be documented in the release notes of the next release. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 30, 2020
@jonas-schievink jonas-schievink added this to the 1.47 milestone Jul 30, 2020
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay
Copy link
Member

dtolnay commented Jul 30, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jul 30, 2020

📌 Commit 68017c2d4ad7018696e56219bceb3d878801acb0 has been approved by dtolnay

@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 Jul 30, 2020
@dtolnay
Copy link
Member

dtolnay commented Jul 30, 2020

@bors r-

Libcore tests need to be updated.

error[E0599]: no method named `as_deref_err` found for reference `&std::result::Result<u8, &i32>` in the current scope
   --> library/core/tests/result.rs:257:24
    |
257 |     assert_eq!(ref_err.as_deref_err(), expected_result);
    |                        ^^^^^^^^^^^^ method not found in `&std::result::Result<u8, &i32>`

@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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 30, 2020
@tesuji tesuji requested a review from dtolnay July 31, 2020 03:24
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay
Copy link
Member

dtolnay commented Aug 2, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Aug 2, 2020

📌 Commit 6d293ed has been approved by dtolnay

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 2, 2020
@bors
Copy link
Contributor

bors commented Aug 2, 2020

⌛ Testing commit 6d293ed with merge 19ecce3...

@bors
Copy link
Contributor

bors commented Aug 3, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: dtolnay
Pushing 19ecce3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 3, 2020
@bors bors merged commit 19ecce3 into rust-lang:master Aug 3, 2020
@tesuji tesuji deleted the stalize-result-as-deref branch August 3, 2020 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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
5 participants