about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-11-30 14:34:27 +0000
committerbors <bors@rust-lang.org>2024-11-30 14:34:27 +0000
commite93e096cc88728337fb41ff74431ebe71a1b4663 (patch)
tree1c68490f853f25cc8bd7228ef92c384dbe774dc9 /compiler/rustc_parse/src/parser/expr.rs
parente48ddd8a0bbd1769587017f04c518d686ea3b206 (diff)
parent6512836be0a8650d11fb440534f54b60baf35eb7 (diff)
downloadrust-e93e096cc88728337fb41ff74431ebe71a1b4663.tar.gz
rust-e93e096cc88728337fb41ff74431ebe71a1b4663.zip
Auto merge of #133658 - jieyouxu:rollup-rq7e0gk, r=jieyouxu
Rollup of 10 pull requests

Successful merges:

 - #116161 (Stabilize `extended_varargs_abi_support`)
 - #132750 ([AIX] handle libunwind native_libs)
 - #133488 (tests: Add regression test for self referential structs with cow as last field)
 - #133569 (Bump `ruzstd` to 0.7.3)
 - #133585 (Do not call `extern_crate` on current trait on crate mismatch errors)
 - #133587 (Fix target_feature handling in freg of LoongArch inline assembly)
 - #133599 (Add `+forced-atomics` feature to esp32s2 no_std  target)
 - #133620 (Simplify hir_typeck_pass_to_variadic_function)
 - #133623 (Improve span handling in `parse_expr_bottom`.)
 - #133625 (custom MIR: add doc comment for debuginfo)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index aa5e9586daf..4430d2d1431 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1446,34 +1446,31 @@ impl<'a> Parser<'a> {
                     this.parse_expr_closure()
                 } else {
                     assert!(this.eat_keyword(kw::For));
-                    this.parse_expr_for(None, this.prev_token.span)
+                    this.parse_expr_for(None, lo)
                 }
             } else if this.eat_keyword(kw::While) {
-                this.parse_expr_while(None, this.prev_token.span)
+                this.parse_expr_while(None, lo)
             } else if let Some(label) = this.eat_label() {
                 this.parse_expr_labeled(label, true)
             } else if this.eat_keyword(kw::Loop) {
-                let sp = this.prev_token.span;
-                this.parse_expr_loop(None, this.prev_token.span).map_err(|mut err| {
-                    err.span_label(sp, "while parsing this `loop` expression");
+                this.parse_expr_loop(None, lo).map_err(|mut err| {
+                    err.span_label(lo, "while parsing this `loop` expression");
                     err
                 })
             } else if this.eat_keyword(kw::Match) {
-                let match_sp = this.prev_token.span;
                 this.parse_expr_match().map_err(|mut err| {
-                    err.span_label(match_sp, "while parsing this `match` expression");
+                    err.span_label(lo, "while parsing this `match` expression");
                     err
                 })
             } else if this.eat_keyword(kw::Unsafe) {
-                let sp = this.prev_token.span;
                 this.parse_expr_block(None, lo, BlockCheckMode::Unsafe(ast::UserProvided)).map_err(
                     |mut err| {
-                        err.span_label(sp, "while parsing this `unsafe` expression");
+                        err.span_label(lo, "while parsing this `unsafe` expression");
                         err
                     },
                 )
             } else if this.check_inline_const(0) {
-                this.parse_const_block(lo.to(this.token.span), false)
+                this.parse_const_block(lo, false)
             } else if this.may_recover() && this.is_do_catch_block() {
                 this.recover_do_catch()
             } else if this.is_try_block() {
@@ -1514,7 +1511,7 @@ impl<'a> Parser<'a> {
                         this.parse_expr_closure()
                     }
                 } else if this.eat_keyword_noexpect(kw::Await) {
-                    this.recover_incorrect_await_syntax(lo, this.prev_token.span)
+                    this.recover_incorrect_await_syntax(lo)
                 } else {
                     this.parse_expr_lit()
                 }