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::map_or #66570

Merged
merged 2 commits into from
Dec 16, 2019
Merged

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented Nov 20, 2019

r? @SimonSapin
Closes #66293

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

r? @Dylan-DPC

@Dylan-DPC-zz
Copy link

r? @SimonSapin

@tesuji
Copy link
Contributor Author

tesuji commented Nov 23, 2019

r? @sfackler

@rust-highfive rust-highfive assigned sfackler and unassigned SimonSapin Nov 23, 2019
@tesuji tesuji closed this Nov 25, 2019
@tesuji tesuji reopened this Nov 25, 2019
@tesuji
Copy link
Contributor Author

tesuji commented Nov 25, 2019

r? @dtolnay

@dtolnay
Copy link
Member

dtolnay commented Nov 27, 2019

Thanks @lzutao!

This is a brand new API (#66292) but it is a sensible complement to Result::map_or_else which we have decided already to stabilize in 1.41.0 (#66322) and matches Option::map_or which has existed since 1.0.0.

impl<T, E> Result<T, E> {
    pub fn map_or<U, F: FnOnce(T) -> U>(self, default: U, f: F) -> U {
        match self {
            Ok(t) => f(t),
            Err(_) => default,
        }
    }
}

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Nov 27, 2019

Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), 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 Nov 27, 2019
@bors
Copy link
Contributor

bors commented Dec 2, 2019

☔ The latest upstream changes (presumably #66944) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC-zz
Copy link

@Amanieu @Kimundi @withoutboats waiting for your approval on this

@dtolnay
Copy link
Member

dtolnay commented Dec 13, 2019

The changes in the PR look good to me as of 93438fd, r=me once the FCP is finished.

@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 Dec 15, 2019
@rfcbot
Copy link

rfcbot commented Dec 15, 2019

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

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

@Dylan-DPC-zz
Copy link

@bors r+

@bors
Copy link
Contributor

bors commented Dec 15, 2019

📌 Commit 93438fd has been approved by Dylan-DPC

@bors
Copy link
Contributor

bors commented Dec 15, 2019

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

@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 Dec 15, 2019
Centril added a commit to Centril/rust that referenced this pull request Dec 15, 2019
bors added a commit that referenced this pull request Dec 15, 2019
Rollup of 6 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #67206 (Update cargo, books)
 - #67285 (Indicate origin of where type parameter for uninferred types )
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)

Failed merges:

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Dec 16, 2019
@bors
Copy link
Contributor

bors commented Dec 16, 2019

⌛ Testing commit 93438fd with merge 1cf33f4049982b6f42b97edf8185b36dee0b8b56...

@rust-highfive
Copy link
Collaborator

Your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Dec 16, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 16, 2019
bors added a commit that referenced this pull request Dec 16, 2019
Rollup of 7 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #66735 (Add str::strip_prefix and str::strip_suffix)
 - #66771 (Stabilize the `core::panic` module)
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)
 - #67325 (cleanup with push_fake_read)

Failed merges:

r? @ghost
@Centril
Copy link
Contributor

Centril commented Dec 16, 2019

@bors retry

@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 Dec 16, 2019
bors added a commit that referenced this pull request Dec 16, 2019
Rollup of 7 pull requests

Successful merges:

 - #65778 (Stabilize `std::{rc,sync}::Weak::{weak_count, strong_count}`)
 - #66570 (stabilize Result::map_or)
 - #66735 (Add str::strip_prefix and str::strip_suffix)
 - #66771 (Stabilize the `core::panic` module)
 - #67317 (fix type_name_of_val doc comment)
 - #67324 (Fix repetition in matches/mod.rs)
 - #67325 (cleanup with push_fake_read)

Failed merges:

r? @ghost
@bors bors merged commit 93438fd into rust-lang:master Dec 16, 2019
@tesuji tesuji deleted the stabilize-result-map_or branch December 16, 2019 15:32
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.

Tracking issue for Result::map_or
10 participants