about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2021-08-28 17:35:39 -0700
committerMichael Howell <michael@notriddle.com>2021-08-28 20:56:55 -0700
commitf7c0566b1209fc7c29d9621cb482acdf58dabd65 (patch)
tree4e6a2c7ef925ea5f6e4535d53cce46fc07641a2b /compiler/rustc_parse/src/parser/expr.rs
parentd562848268e02d6cf342598551bc663fcd4ff341 (diff)
downloadrust-f7c0566b1209fc7c29d9621cb482acdf58dabd65.tar.gz
rust-f7c0566b1209fc7c29d9621cb482acdf58dabd65.zip
fix(rustc_parse): incorrect span information for macro path expr
Old error output:

    3  |         let _: usize = $f;
       |                -----     ^ expected `usize`, found struct `Baz`
       |                |
       |                expected due to this

New error output:

    3  |         let _: usize = $f;
       |                -----   ^^ expected `usize`, found struct `Baz`
       |                |
       |                expected due to this
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-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 bb7e44b18d2..eea6c482cf1 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -41,7 +41,7 @@ macro_rules! maybe_whole_expr {
                     let path = path.clone();
                     $p.bump();
                     return Ok($p.mk_expr(
-                        $p.token.span,
+                        $p.prev_token.span,
                         ExprKind::Path(None, path),
                         AttrVec::new(),
                     ));