about summary refs log tree commit diff
path: root/compiler/rustc_parse
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2021-08-28 17:28:39 -0700
committerMichael Howell <michael@notriddle.com>2021-08-28 17:59:00 -0700
commitd562848268e02d6cf342598551bc663fcd4ff341 (patch)
treec6701da3a8762adc5c0250465392909bde017eed /compiler/rustc_parse
parent926f069950d7211a87fbd81778b420de420daad7 (diff)
downloadrust-d562848268e02d6cf342598551bc663fcd4ff341.tar.gz
rust-d562848268e02d6cf342598551bc663fcd4ff341.zip
fix(rustc_parse): incorrect span information for macro block expr
Old error output:

   = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
help: wrap this expression in parentheses
   |
4  |             break '_l $f(;)
   |                         ^ ^

New error output:

   = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
help: wrap this expression in parentheses
   |
4  |             break '_l ($f);
   |                       ^  ^
Diffstat (limited to 'compiler/rustc_parse')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 326c8f81ffb..bb7e44b18d2 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -50,7 +50,7 @@ macro_rules! maybe_whole_expr {
                     let block = block.clone();
                     $p.bump();
                     return Ok($p.mk_expr(
-                        $p.token.span,
+                        $p.prev_token.span,
                         ExprKind::Block(block, None),
                         AttrVec::new(),
                     ));