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:
Esteban Küber 2017-03-24 19:14:58 -07:00
parent c62e532f3d
commit 03eca71381
8 changed files with 37 additions and 20 deletions

View file

@ -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

View file

@ -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