-
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
'label can start expressions #50155
'label can start expressions #50155
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
src/libsyntax/parse/token.rs
Outdated
@@ -277,6 +277,7 @@ impl Token { | |||
DotDot | DotDotDot | DotDotEq | // range notation | |||
Lt | BinOp(Shl) | // associated path | |||
ModSep | // global path | |||
Lifetime(..) | // labeled loop | |||
Pound => true, // expression attributes | |||
Interpolated(ref nt) => match nt.0 { | |||
NtIdent(..) | NtExpr(..) | NtBlock(..) | NtPath(..) => true, |
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.
Could you add NtLifetime
here as well?
This also needs a test, something like return 'label: loop {}
will start parsing with Lifetime(..)
being able to start an expression.
let foo = 'label: loop { break 'label 42; }; is valid Rust code.
a63f224
to
edee60d
Compare
@bors r+ |
📌 Commit edee60d has been approved by |
'label can start expressions ```Rust let foo = 'label: loop { break 'label 42; }; ``` is valid Rust code.
☀️ Test successful - status-appveyor, status-travis |
is valid Rust code.