-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking issue for RFC 2388, reserve the try
keyword and resolve do catch { .. }
syntax question with try { .. }
#50412
Comments
Huh this is not mentioned in the RFC at all. (Currently |
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 |
Where is the part that the try macro should still be allowed? What happened to that? |
As I mentioned to @est3I believe that we ought to be able to support |
Done :) |
cc @Manishearth on |
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 |
@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”; // same If it were like return try ((try “xyzzy”s) + “plover”); // ok, but redundant Overall, the paper's |
I'm yet to see a good explanation of the semantics of all this |
@alexreg see " |
@Nemo157 Okay, that makes the semantics of |
@alexreg |
@cramertj Oh good. Just scoping of the |
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 |
@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? |
@glmdgrielson The difference with |
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.) |
Implement try block expressions I noticed that `try` wasn't a keyword yet in Rust 2018, so... ~~Fixes rust-lang#52604 That was fixed by PR rust-lang#53135 cc rust-lang#31436 rust-lang#50412
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. |
try
for try { .. }
block expressions"try
keyword and replace do catch { .. }
syntax with try { .. }
try
keyword and replace do catch { .. }
syntax with try { .. }
try
keyword and resolve do catch { .. }
syntax question with try { .. }
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? |
also, tagging as P-high |
@pnkfelix I believe that everything edition sensitive has been done wrt. keyword reservation and such. |
I've checked the checkboxes above:
So I think we're good to close this one? |
@scottmcm yeah I think we can close it... should we perhaps open a new tracking issue for |
Newbie here....So ...how do I replace ? r#try!(m.add(py, "test", py_fn!(py, test()))); |
|
Thanks @cramertj .... run into these syntax issues all the time with rust, but I still love what the language is about, ... I've become a huge rust fan and plan on sticking with it. |
This is a tracking issue for the RFC "Reserve
try
fortry { .. }
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 Tracking issue for?
operator andtry
blocks (RFC 243,question_mark
&try_blocks
features) #31436.try
as an identifierEnsure thattry { .. } $ident { .. }
does not parse(so that we have options for
try { .. } catch { .. }
).?
operator andtry
blocks (RFC 243,question_mark
&try_blocks
features) #31436 insteadUnresolved questions:
try!(expr)
still work in edition 2018+? If so, how exactly should it?Resolution: it should not.
The text was updated successfully, but these errors were encountered: