about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-10-26 04:34:46 +0000
committerbors <bors@rust-lang.org>2020-10-26 04:34:46 +0000
commit1cd97cad6e5f85bed455f505f330ead1d5cd8432 (patch)
tree7713c2e1b72df2e80cebedfacf98a4d85aab2720 /compiler/rustc_parse/src/parser
parent16e9ed0b1c58e0327eb37eb6f70e9b9ef1844591 (diff)
parentc8e0f4d90b474492485e869be81b0d452dbe1926 (diff)
downloadrust-1cd97cad6e5f85bed455f505f330ead1d5cd8432.tar.gz
rust-1cd97cad6e5f85bed455f505f330ead1d5cd8432.zip
Auto merge of #78387 - Dylan-DPC:rollup-ch0st6z, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #74477 (`#[deny(unsafe_op_in_unsafe_fn)]` in sys/wasm)
 - #77836 (transmute_copy: explain that alignment is handled correctly)
 - #78126 (Properly define va_arg and va_list for aarch64-apple-darwin)
 - #78137 (Initialize tracing subscriber in compiletest tool)
 - #78161 (Add issue template link to IRLO)
 - #78214 (Tweak match arm semicolon removal suggestion to account for futures)
 - #78247 (Fix #78192)
 - #78252 (Add codegen test for #45964)
 - #78268 (Do not try to report on closures to avoid ICE)
 - #78295 (Add some regression tests)

Failed merges:

r? `@ghost`
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index 1ea01d95a13..39e1256a578 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -1207,7 +1207,13 @@ impl<'a> Parser<'a> {
             self.recover_await_prefix(await_sp)?
         };
         let sp = self.error_on_incorrect_await(lo, hi, &expr, is_question);
-        let expr = self.mk_expr(lo.to(sp), ExprKind::Await(expr), attrs);
+        let kind = match expr.kind {
+            // Avoid knock-down errors as we don't know whether to interpret this as `foo().await?`
+            // or `foo()?.await` (the very reason we went with postfix syntax 😅).
+            ExprKind::Try(_) => ExprKind::Err,
+            _ => ExprKind::Await(expr),
+        };
+        let expr = self.mk_expr(lo.to(sp), kind, attrs);
         self.maybe_recover_from_bad_qpath(expr, true)
     }