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

Lower `?` to `Try` instead of `Carrier` #42275

Merged
merged 3 commits into from Jun 1, 2017

Conversation

Projects
None yet
5 participants
@scottmcm
Member

scottmcm commented May 28, 2017

The easy parts of rust-lang/rfcs#1859, whose FCP completed without further comments.

Just the trait and the lowering -- neither the error message improvements nor the insta-stable impl for Option nor exhaustive docs.

Based on a github search, this will break the following:

The other results appear to be files from libcore or its tests. I could also leave Carrier around after stage0 and impl<T:Carrier> Try for T if that would be better.

r? @nikomatsakis

Edit: Oh, and it might accidentally improve perf, based on #37939 (comment), since Try::into_result for Result is an obvious no-op, unlike Carrier::translate.

Lower `?` to `Try` instead of `Carrier`
The easy parts of RFC 1859.  (Just the trait and the lowering, none of
the error message improvements nor the insta-stable impl for Option.)
@@ -0,0 +1,7 @@
# `try_trait`

The tracking issue for this feature is: [#31436]

This comment has been minimized.

@nikomatsakis

nikomatsakis May 30, 2017

Contributor

Can we say a bit more here?

This comment has been minimized.

@scottmcm

scottmcm May 31, 2017

Member

Added a bit more unstable-book text. I'm uncertain exactly what's supposed to be in it; is there anything in particular you'd like me to address there?

/// in terms of a success/failure dichotomy. This trait allows both
/// extracting those success or failure values from an existing instance and
/// creating a new instance from a success or failure value.
#[unstable(feature = "try_trait", issue = "31436")]

This comment has been minimized.

@nikomatsakis

nikomatsakis May 30, 2017

Contributor

so I also re-used #31436 as the tracking issue, but I wonder if we should make a new issue just for this feature? It would seem to make things a bit clearer e.g. when we call for FCP...

This comment has been minimized.

@bstrie

bstrie May 30, 2017

Contributor

@nikomatsakis As policy I tend to favor making tracking issues as fine-grained as possible, specifically because of the nightmare that the original ? RFC became due to needless conflation with catch.

This comment has been minimized.

@scottmcm

scottmcm May 31, 2017

Member

Created #42327 and updated the attributes.

@nikomatsakis

This looks good as a start! The only thing that may be worth doing is adding a bit more text into the "unstable book".

@nikomatsakis

This comment has been minimized.

Contributor

nikomatsakis commented May 30, 2017

cc @pfpacket @peterdelevoryas -- just a heads-up that, when this lands, the (unstable) Carrier trait is going to be replaced with Try.

@nikomatsakis

This comment has been minimized.

Contributor

nikomatsakis commented May 31, 2017

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented May 31, 2017

📌 Commit 3119e63 has been approved by nikomatsakis

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Jun 1, 2017

Rollup merge of rust-lang#42275 - scottmcm:try-trait, r=nikomatsakis
Lower `?` to `Try` instead of `Carrier`

The easy parts of rust-lang/rfcs#1859, whose FCP completed without further comments.

Just the trait and the lowering -- neither the error message improvements nor the insta-stable impl for Option nor exhaustive docs.

Based on a [github search](https://github.com/search?l=rust&p=1&q=question_mark_carrier&type=Code&utf8=%E2%9C%93), this will break the following:

- https://github.com/pfpacket/rust-9p/blob/00206e34c680198a0ac7c2f066cc2954187d4fac/src/serialize.rs#L38
- https://github.com/peterdelevoryas/bufparse/blob/b1325898f4fc2c67658049196c12da82548af350/src/result.rs#L50

The other results appear to be files from libcore or its tests.  I could also leave Carrier around after stage0 and `impl<T:Carrier> Try for T` if that would be better.

r? @nikomatsakis

Edit: Oh, and it might accidentally improve perf, based on rust-lang#37939 (comment), since `Try::into_result` for `Result` is an obvious no-op, unlike `Carrier::translate`.

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Jun 1, 2017

Rollup merge of rust-lang#42275 - scottmcm:try-trait, r=nikomatsakis
Lower `?` to `Try` instead of `Carrier`

The easy parts of rust-lang/rfcs#1859, whose FCP completed without further comments.

Just the trait and the lowering -- neither the error message improvements nor the insta-stable impl for Option nor exhaustive docs.

Based on a [github search](https://github.com/search?l=rust&p=1&q=question_mark_carrier&type=Code&utf8=%E2%9C%93), this will break the following:

- https://github.com/pfpacket/rust-9p/blob/00206e34c680198a0ac7c2f066cc2954187d4fac/src/serialize.rs#L38
- https://github.com/peterdelevoryas/bufparse/blob/b1325898f4fc2c67658049196c12da82548af350/src/result.rs#L50

The other results appear to be files from libcore or its tests.  I could also leave Carrier around after stage0 and `impl<T:Carrier> Try for T` if that would be better.

r? @nikomatsakis

Edit: Oh, and it might accidentally improve perf, based on rust-lang#37939 (comment), since `Try::into_result` for `Result` is an obvious no-op, unlike `Carrier::translate`.

bors added a commit that referenced this pull request Jun 1, 2017

Auto merge of #42346 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests

- Successful merges: #41968, #42275, #42286, #42297, #42302, #42306, #42314, #42324
- Failed merges:

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Jun 1, 2017

Rollup merge of rust-lang#42275 - scottmcm:try-trait, r=nikomatsakis
Lower `?` to `Try` instead of `Carrier`

The easy parts of rust-lang/rfcs#1859, whose FCP completed without further comments.

Just the trait and the lowering -- neither the error message improvements nor the insta-stable impl for Option nor exhaustive docs.

Based on a [github search](https://github.com/search?l=rust&p=1&q=question_mark_carrier&type=Code&utf8=%E2%9C%93), this will break the following:

- https://github.com/pfpacket/rust-9p/blob/00206e34c680198a0ac7c2f066cc2954187d4fac/src/serialize.rs#L38
- https://github.com/peterdelevoryas/bufparse/blob/b1325898f4fc2c67658049196c12da82548af350/src/result.rs#L50

The other results appear to be files from libcore or its tests.  I could also leave Carrier around after stage0 and `impl<T:Carrier> Try for T` if that would be better.

r? @nikomatsakis

Edit: Oh, and it might accidentally improve perf, based on rust-lang#37939 (comment), since `Try::into_result` for `Result` is an obvious no-op, unlike `Carrier::translate`.

bors added a commit that referenced this pull request Jun 1, 2017

Auto merge of #42348 - frewsxcv:rollup, r=frewsxcv
Rollup of 9 pull requests

- Successful merges: #42136, #42275, #42286, #42297, #42302, #42306, #42314, #42324, #42347
- Failed merges:

@bors bors merged commit 3119e63 into rust-lang:master Jun 1, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@scottmcm scottmcm deleted the scottmcm:try-trait branch Jun 1, 2017

pfpacket added a commit to pfpacket/rust-9p that referenced this pull request Jun 2, 2017

Support new trait 'std::op::Try'
Direct replacement of std::op::Carrier
rust-lang/rust#42275
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment