about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-06-23 12:28:12 +0000
committerbors <bors@rust-lang.org>2019-06-23 12:28:12 +0000
commit5d677b2efdb00031564d30ee9f63f4d4f936a39f (patch)
treecf7f1b1a463a8a5ebbd802bd9cb61fe10d3fea0a /src/libsyntax/ext
parenta96ba969156d257e5d5b692946fa8fe40ed6543a (diff)
parentc75f7ecaee508c568c0bc01c102965ce8b2246ef (diff)
downloadrust-5d677b2efdb00031564d30ee9f63f4d4f936a39f.tar.gz
rust-5d677b2efdb00031564d30ee9f63f4d4f936a39f.zip
Auto merge of #60861 - Centril:let-chains-ast-intro, r=petrochenkov
[let_chains, 2/6] Introduce `Let(..)` in AST, remove IfLet + WhileLet and parse let chains

Here we remove `ast::ExprKind::{IfLet, WhileLet}` and introduce `ast::ExprKind::Let`.
Moreover, we also:
+ connect the parsing logic for let chains
+ introduce the feature gate
+ rewire HIR lowering a bit.

However, this does not connect the new syntax to semantics in HIR.
That will be the subject of a subsequent PR.

Per https://github.com/rust-lang/rust/issues/53667#issuecomment-471583239.
Next step after https://github.com/rust-lang/rust/pull/59288.

cc @Manishearth re. Clippy.

r? @oli-obk
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index d5da4c920bc..92ce3779a3c 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -825,7 +825,9 @@ fn may_begin_with(token: &Token, name: Name) -> bool {
     }
 
     match name {
-        sym::expr => token.can_begin_expr(),
+        sym::expr => token.can_begin_expr()
+            // This exception is here for backwards compatibility.
+            && !token.is_keyword(kw::Let),
         sym::ty => token.can_begin_type(),
         sym::ident => get_macro_name(token).is_some(),
         sym::literal => token.can_begin_literal_or_bool(),