Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for RFC 2388, reserve the `try` keyword and resolve `do catch { .. }` syntax question with `try { .. }` #50412
Comments
Centril
added
B-RFC-approved
T-lang
C-tracking-issue
labels
May 3, 2018
Centril
referenced this issue
May 3, 2018
Merged
RFC: Reserve `try` for `try { .. }` block expressions #2388
nikomatsakis
referenced this issue
May 3, 2018
Open
Tracking issue for `?` operator and `try` blocks (RFC 243, `question_mark` & `try_blocks` features) #31436
Centril
added
WG-epoch
A-lint
T-compiler
labels
May 3, 2018
This was referenced May 3, 2018
This comment has been minimized.
This comment has been minimized.
Huh this is not mentioned in the RFC at all. (Currently |
This comment has been minimized.
This comment has been minimized.
It's discussed in the RFC comments tho :) This is just future proofing. I'm not saying we should necessarily add But if we can solve the |
This comment has been minimized.
This comment has been minimized.
|
Where is the part that the try macro should still be allowed? What happened to that? |
This comment has been minimized.
This comment has been minimized.
|
As I mentioned to @est3I believe that we ought to be able to support |
This comment has been minimized.
This comment has been minimized.
Done :) |
This comment has been minimized.
This comment has been minimized.
|
cc @Manishearth on |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Very interesting cpp proposal just as this RFC wants to bury A big point for this RFC was familiarity with other languages. Now as finally other languages are becoming familiar to us we get rid of those now familiar components and adopt their legacy idioms. This isn't really good. So why not be consistent with Cpp here and adopt their |
This comment has been minimized.
This comment has been minimized.
|
@est31 That paper is consistent with this RFC's use of try return “xyzzy”s + “plover”; // ok, covers both “”s and +
return try “xyzzy”s + “plover”; // sameIf it were like return try ((try “xyzzy”s) + “plover”); // ok, but redundantOverall, the paper's |
This comment has been minimized.
This comment has been minimized.
|
I'm yet to see a good explanation of the semantics of all this |
This comment has been minimized.
This comment has been minimized.
|
@alexreg see " |
This comment has been minimized.
This comment has been minimized.
|
@Nemo157 Okay, that makes the semantics of |
This comment has been minimized.
This comment has been minimized.
|
@alexreg |
This comment has been minimized.
This comment has been minimized.
|
@cramertj Oh good. Just scoping of the |
This comment has been minimized.
This comment has been minimized.
glmdgrielson
commented
Jul 21, 2018
|
Wait, why does this need to be an unconditional keyword? I'm a bit uncomfortable about this since this means that code somebody just copied may break when pasted into a new file for no obvious reason. Why can't we handle it like |
This comment has been minimized.
This comment has been minimized.
|
@glmdgrielson See the discussion in #31436. In short, struct try { a: Option<u32> }
let a = Some(1);
let b = try { a }; // is this a `try` expression or a struct literal? |
This comment has been minimized.
This comment has been minimized.
|
@glmdgrielson The difference with |
bors
added a commit
that referenced
this issue
Jul 28, 2018
scottmcm
added this to the Rust 2018 Release milestone
Aug 6, 2018
This comment has been minimized.
This comment has been minimized.
|
Added this to the edition milestone for tracking purposes, since this issue is all about restricting in the edition. (For extra clarity: stabilization of the feature is #31436, which is not part of the edition.) |
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
Aug 22, 2018
bors
added a commit
that referenced
this issue
Aug 23, 2018
bors
added a commit
that referenced
this issue
Aug 23, 2018
bors
added a commit
that referenced
this issue
Aug 23, 2018
This comment has been minimized.
This comment has been minimized.
|
I was mislead by the title of this RFC. I thought it was only about reserving the keyword to have another option available for a later decision. The title should have indicated that it also makes a "normative" change to syntax introduced in a previously-accepted RFC. |
SimonSapin
changed the title
Tracking issue for RFC 2388, "Reserve `try` for `try { .. }` block expressions"
Tracking issue for RFC 2388, reserve the `try` keyword and replace `do catch { .. }` syntax with `try { .. }`
Aug 23, 2018
scottmcm
changed the title
Tracking issue for RFC 2388, reserve the `try` keyword and replace `do catch { .. }` syntax with `try { .. }`
Tracking issue for RFC 2388, reserve the `try` keyword and resolve `do catch { .. }` syntax question with `try { .. }`
Aug 23, 2018
Centril
referenced this issue
Aug 24, 2018
Closed
Macro invocations bypass new keyword identifier checks #53686
This comment has been minimized.
This comment has been minimized.
|
visted for T-compiler triage. It seems like progress here has ... stalled? Does someone own the remaining steps here, given that it is on the 2018 Release Milestone? |
This comment has been minimized.
This comment has been minimized.
|
also, tagging as P-high |
pnkfelix
added
the
P-high
label
Nov 8, 2018
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix I believe that everything edition sensitive has been done wrt. keyword reservation and such. |
This comment has been minimized.
This comment has been minimized.
|
I've checked the checkboxes above:
So I think we're good to close this one? |
This comment has been minimized.
This comment has been minimized.
|
@scottmcm yeah I think we can close it... should we perhaps open a new tracking issue for |
Centril commentedMay 3, 2018
•
edited by scottmcm
This is a tracking issue for the RFC "Reserve
tryfortry { .. }block expressions" (rust-lang/rfcs#2388).This issue only tracks the keyword reservation in edition 2018,
and renaming
do catch { .. }totry { .. }.For the main issue, see #31436.
Steps:
cc @Manishearth, @scottmcm )
try { .. }is tracked via #31436.tryas an identifierEnsure thattry { .. } $ident { .. }does not parse(so that we have options for
try { .. } catch { .. }).Unresolved questions:
try!(expr)still work in edition 2018+? If so, how exactly should it?Resolution: it should not.