expand: add recovery for parse_nt
This commit is contained in:
parent
3979964200
commit
21944b3a10
5 changed files with 63 additions and 16 deletions
|
|
@ -42,6 +42,11 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
|
|||
LL |
|
||||
LL | fn main() {}
|
||||
| ^^ unexpected token
|
||||
|
|
||||
::: $SRC_DIR/libcore/macros/mod.rs:LL:COL
|
||||
|
|
||||
LL | ($left:expr, $right:expr) => ({
|
||||
| ---------- while parsing argument for this `expr` macro fragment
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
|||
10
src/test/ui/parser/nt-parsing-has-recovery.rs
Normal file
10
src/test/ui/parser/nt-parsing-has-recovery.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
macro_rules! foo {
|
||||
($e:expr) => {}
|
||||
}
|
||||
|
||||
foo!(1 + @); //~ ERROR expected expression, found `@`
|
||||
foo!(1 + @); //~ ERROR expected expression, found `@`
|
||||
|
||||
fn main() {
|
||||
let _recovery_witness: () = 0; //~ ERROR mismatched types
|
||||
}
|
||||
29
src/test/ui/parser/nt-parsing-has-recovery.stderr
Normal file
29
src/test/ui/parser/nt-parsing-has-recovery.stderr
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
error: expected expression, found `@`
|
||||
--> $DIR/nt-parsing-has-recovery.rs:5:10
|
||||
|
|
||||
LL | ($e:expr) => {}
|
||||
| ------- while parsing argument for this `expr` macro fragment
|
||||
...
|
||||
LL | foo!(1 + @);
|
||||
| ^ expected expression
|
||||
|
||||
error: expected expression, found `@`
|
||||
--> $DIR/nt-parsing-has-recovery.rs:6:10
|
||||
|
|
||||
LL | ($e:expr) => {}
|
||||
| ------- while parsing argument for this `expr` macro fragment
|
||||
...
|
||||
LL | foo!(1 + @);
|
||||
| ^ expected expression
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/nt-parsing-has-recovery.rs:9:33
|
||||
|
|
||||
LL | let _recovery_witness: () = 0;
|
||||
| -- ^ expected `()`, found integer
|
||||
| |
|
||||
| expected due to this
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue