Skip to content

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
Collaborator

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 force-pushed the stalize-result-as-deref branch from 68017c2 to 0b61b61 Compare July 31, 2020 02:43
@tesuji tesuji force-pushed the stalize-result-as-deref branch from 0b61b61 to 6d293ed Compare July 31, 2020 02:44
@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
Collaborator

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
Collaborator

bors commented Aug 2, 2020

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

@bors
Copy link
Collaborator

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
Development

Successfully merging this pull request may close these issues.

Tracking issue for Option::deref, Result::deref, Result::deref_ok, and Result::deref_err (feature: inner_deref)
5 participants