about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/diagnostics.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-11-30 12:56:54 +0800
committerGitHub <noreply@github.com>2024-11-30 12:56:54 +0800
commitea72c19c7d136aedcaf0f2adf823966a4f5e45f9 (patch)
treee1ce7809ee03682e2ddc5404431eb399c2488059 /compiler/rustc_parse/src/parser/diagnostics.rs
parentc112195fec0084faf1ac375abd24ac5248dbf712 (diff)
parent90ad2adfea5a7f4baebb083cd3a190fa491d0ec8 (diff)
downloadrust-ea72c19c7d136aedcaf0f2adf823966a4f5e45f9.tar.gz
rust-ea72c19c7d136aedcaf0f2adf823966a4f5e45f9.zip
Rollup merge of #133623 - nnethercote:parse_expr_bottom-spans, r=compiler-errors
Improve span handling in `parse_expr_bottom`.

`parse_expr_bottom` stores `this.token.span` in `lo`, but then fails to use it in many places where it could. This commit fixes that, and likewise (to a smaller extent) in `parse_ty_common`.

r? ``@spastorino``
Diffstat (limited to 'compiler/rustc_parse/src/parser/diagnostics.rs')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index a1fe5508970..34131e3af6e 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -1990,7 +1990,6 @@ impl<'a> Parser<'a> {
     /// `await? <expr>`, `await(<expr>)`, and `await { <expr> }`.
     pub(super) fn recover_incorrect_await_syntax(
         &mut self,
-        lo: Span,
         await_sp: Span,
     ) -> PResult<'a, P<Expr>> {
         let (hi, expr, is_question) = if self.token == token::Not {
@@ -1999,8 +1998,8 @@ impl<'a> Parser<'a> {
         } else {
             self.recover_await_prefix(await_sp)?
         };
-        let (sp, guar) = self.error_on_incorrect_await(lo, hi, &expr, is_question);
-        let expr = self.mk_expr_err(lo.to(sp), guar);
+        let (sp, guar) = self.error_on_incorrect_await(await_sp, hi, &expr, is_question);
+        let expr = self.mk_expr_err(await_sp.to(sp), guar);
         self.maybe_recover_from_bad_qpath(expr)
     }