about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2023-12-12 17:33:51 -0800
committerEric Holk <ericholk@microsoft.com>2023-12-19 16:12:17 -0800
commit397f4a15bbcad7d22f8c09edb72a0d49e3da80c9 (patch)
tree925131df7b98912bf0c219f3e229094d200dab0c /compiler/rustc_parse/src/parser
parent97df0d3657fafac6e6ca481c1d4123bf6e2633f1 (diff)
downloadrust-397f4a15bbcad7d22f8c09edb72a0d49e3da80c9.tar.gz
rust-397f4a15bbcad7d22f8c09edb72a0d49e3da80c9.zip
Add additional tests and update existing tests
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index f424040e4ea..85f785b3401 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -2684,7 +2684,8 @@ impl<'a> Parser<'a> {
 
     /// Parses `for await? <src_pat> in <src_expr> <src_loop_block>` (`for` token already eaten).
     fn parse_expr_for(&mut self, opt_label: Option<Label>, lo: Span) -> PResult<'a, P<Expr>> {
-        let is_await = self.eat_keyword(kw::Await);
+        let is_await =
+            self.token.uninterpolated_span().at_least_rust_2018() && self.eat_keyword(kw::Await);
 
         if is_await {
             self.sess.gated_spans.gate(sym::async_for_loop, self.prev_token.span);