Point at last valid token on failed expect_one_of
```rust
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)`
--> $DIR/token-error-correct-3.rs:29:9
|
25 | foo()
| - expected one of `.`, `;`, `?`, `}`, or an operator after this
...
29 | } else {
| ^ unexpected token
```
This commit is contained in:
parent
c62e532f3d
commit
03eca71381
8 changed files with 37 additions and 20 deletions
|
|
@ -14,5 +14,7 @@
|
|||
pub fn trace_option(option: Option<isize>) {
|
||||
option.map(|some| 42; //~ NOTE: unclosed delimiter
|
||||
//~^ ERROR: expected one of
|
||||
//~| NOTE: expected one of
|
||||
//~| NOTE: unexpected token
|
||||
} //~ ERROR: incorrect close delimiter
|
||||
//~^ ERROR: expected expression, found `)`
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ macro_rules! ignored_item {
|
|||
|
||||
macro_rules! ignored_expr {
|
||||
() => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,`
|
||||
//~^ NOTE expected one of `.`, `;`, `?`, `}`, or an operator after this
|
||||
//~| NOTE unexpected token
|
||||
2 )
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,4 +12,6 @@
|
|||
|
||||
type A = Box<(Fn(D::Error) -> E) + 'static + Send + Sync>; // OK (but see #39318)
|
||||
|
||||
FAIL //~ ERROR
|
||||
FAIL
|
||||
//~^ ERROR
|
||||
//~| ERROR
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ fn main() {
|
|||
let foo =
|
||||
match //~ NOTE did you mean to remove this `match` keyword?
|
||||
Some(4).unwrap_or_else(5)
|
||||
; //~ ERROR expected one of `.`, `?`, `{`, or an operator, found `;`
|
||||
//~^ NOTE expected one of `.`, `?`, `{`, or an operator after this
|
||||
; //~ NOTE unexpected token
|
||||
//~^ ERROR expected one of `.`, `?`, `{`, or an operator, found `;`
|
||||
|
||||
println!("{}", foo)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,6 @@ fn main() {
|
|||
let x: Box<Debug+> = box 3 as Box<Debug+>; // Trailing `+` is OK
|
||||
}
|
||||
|
||||
FAIL //~ ERROR
|
||||
FAIL
|
||||
//~^ ERROR
|
||||
//~| ERROR
|
||||
|
|
|
|||
|
|
@ -14,13 +14,18 @@ error: expected one of `,`, `.`, `?`, or an operator, found `;`
|
|||
--> $DIR/token-error-correct-3.rs:23:35
|
||||
|
|
||||
23 | callback(path.as_ref(); //~ NOTE: unclosed delimiter
|
||||
| ^
|
||||
| -^ unexpected token
|
||||
| |
|
||||
| expected one of `,`, `.`, `?`, or an operator after this
|
||||
|
||||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)`
|
||||
--> $DIR/token-error-correct-3.rs:29:9
|
||||
|
|
||||
25 | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
|
||||
| - expected one of `.`, `;`, `?`, `}`, or an operator after this
|
||||
...
|
||||
29 | } else { //~ ERROR: incorrect close delimiter: `}`
|
||||
| ^
|
||||
| ^ unexpected token
|
||||
|
||||
error[E0425]: cannot find function `is_directory` in this scope
|
||||
--> $DIR/token-error-correct-3.rs:21:13
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ error: expected one of `)`, `,`, `.`, `<`, `?`, `break`, `continue`, `false`, `f
|
|||
--> $DIR/token-error-correct.rs:14:13
|
||||
|
|
||||
14 | foo(bar(;
|
||||
| ^
|
||||
| -^ unexpected token
|
||||
| |
|
||||
| expected one of `)`, `,`, `.`, `<`, `?`, `break`, `continue`, `false`, `for`, `if`, `loop`, `match`, `move`, `return`, `true`, `unsafe`, `while`, or an operator after this
|
||||
|
||||
error: expected expression, found `)`
|
||||
--> $DIR/token-error-correct.rs:23:1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue