-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement try block expressions #52602
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
6fe5f79
to
26c185a
Compare
This comment has been minimized.
This comment has been minimized.
Ok, I think this is in good enough for a review pass. I've never touched most of these parts of the compiler before, so I suspect there are opportunities for improvement in how I did things 🙃 |
src/libsyntax_pos/symbol.rs
Outdated
@@ -413,23 +413,30 @@ declare_keywords! { | |||
(49, Virtual, "virtual") | |||
(50, Yield, "yield") | |||
|
|||
// Edition-specific keywords currently in use. | |||
(51, Try, "try") // >= 2018 Edition Only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Keywords are not normally moved into the "used" category until the feature is stable (e.g. macro
/yield
/async
are all "reserved for future use").
This comment has been minimized.
This comment has been minimized.
@@ -6,22 +6,24 @@ The tracking issue for this feature is: [#31436] | |||
|
|||
------------------------ | |||
|
|||
The `catch_expr` feature adds support for a `catch` expression. The `catch` | |||
expression creates a new scope one can use the `?` operator in. | |||
The `catch_expr` feature adds support for `try` blocks. A `try` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably rename this to try_expr
?
r? @nikomatsakis for re-assignment. I don't think I'm the right person to review this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
@bors r+ |
📌 Commit ec85915c5ccf9ec1ba2b4183add0fe7efbbaa00c has been approved by |
@bors r- |
One question: do we want to provide a kind of smoother path for people using |
Or do we just not care :) |
@nikomatsakis Here's a sourcegraph query for it, https://sourcegraph.com/search?q=repogroup:crates+case:yes++%5Cbdo%5Cs%2Bcatch%5Cb+max:400 Most of these occurrences are irrelevant and so I think we should not care. |
Also; having the feature called |
@bors retry
|
⌛ Testing commit 0095471 with merge 127d02057977122d7ca0707c27d3ce2a4cbd66db... |
💔 Test failed - status-travis |
The job 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 |
I'm cursed today:
|
@bors retry |
☀️ Test successful - status-appveyor, status-travis |
fix clippy breakage due to rust-lang/rust#52602
As a heads up, we've got a pretty serious issue which may be a bit of a roadblock for this. Currently the compiler doesn't actually warn about usages of the For the edition we'll need to have at least some warning for users of the |
`async` was added in rust-lang/rust#50307 and is not yet implemented `try` was added in rust-lang/rust#52602 and is not yet stable: rust-lang/rust#31436
I noticed that
try
wasn't a keyword yet in Rust 2018, so...Fixes #52604That was fixed by PR #53135cc #31436 #50412