File tree Expand file tree Collapse file tree 5 files changed +64
-2
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 5 files changed +64
-2
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ macro_rules! maybe_whole_expr {
4141 let path = path. clone( ) ;
4242 $p. bump( ) ;
4343 return Ok ( $p. mk_expr(
44- $p. token . span,
44+ $p. prev_token . span,
4545 ExprKind :: Path ( None , path) ,
4646 AttrVec :: new( ) ,
4747 ) ) ;
@@ -50,7 +50,7 @@ macro_rules! maybe_whole_expr {
5050 let block = block. clone( ) ;
5151 $p. bump( ) ;
5252 return Ok ( $p. mk_expr(
53- $p. token . span,
53+ $p. prev_token . span,
5454 ExprKind :: Block ( block, None ) ,
5555 AttrVec :: new( ) ,
5656 ) ) ;
Original file line number Diff line number Diff line change 1+ macro_rules! foo {
2+ ( $f: path ) => { {
3+ let _: usize = $f; //~ERROR
4+ } } ;
5+ }
6+
7+ struct Baz ;
8+
9+ fn main ( ) {
10+ foo ! ( Baz ) ;
11+ }
Original file line number Diff line number Diff line change 1+ error[E0308]: mismatched types
2+ --> $DIR/issue-87812-path.rs:3:24
3+ |
4+ LL | let _: usize = $f;
5+ | ----- ^^ expected `usize`, found struct `Baz`
6+ | |
7+ | expected due to this
8+ ...
9+ LL | foo!(Baz);
10+ | ---------- in this macro invocation
11+ |
12+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
13+
14+ error: aborting due to previous error
15+
16+ For more information about this error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change 1+ #![ deny( break_with_label_and_loop) ]
2+
3+ macro_rules! foo {
4+ ( $f: block ) => {
5+ ' _l: loop {
6+ break ' _l $f; //~ERROR
7+ }
8+ } ;
9+ }
10+
11+ fn main ( ) {
12+ let x = foo ! ( { 3 } ) ;
13+ }
Original file line number Diff line number Diff line change 1+ error: this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression
2+ --> $DIR/issue-87812.rs:6:13
3+ |
4+ LL | break '_l $f;
5+ | ^^^^^^^^^^^^
6+ ...
7+ LL | let x = foo!({ 3 });
8+ | ----------- in this macro invocation
9+ |
10+ note: the lint level is defined here
11+ --> $DIR/issue-87812.rs:1:9
12+ |
13+ LL | #![deny(break_with_label_and_loop)]
14+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
15+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
16+ help: wrap this expression in parentheses
17+ |
18+ LL | break '_l ($f);
19+ | + +
20+
21+ error: aborting due to previous error
22+
You can’t perform that action at this time.
0 commit comments