This website requires JavaScript.
Explore
Help
Register
Sign In
rust-lang
/
rust
Watch
1
Star
0
Fork
0
You've already forked rust
Code
Issues
Pull Requests
Actions
1
Packages
Projects
Releases
Wiki
Activity
Files
b3827e4f3728b77bd3e60587487ebfc3cc8d901b
rust
/
tests
/
ui
/
parser
/
better-expected.rs
4 lines
77 B
Rust
Raw
Normal View
History
Unescape
Escape
Make the parser’s ‘expected <foo>, found <bar>’ errors more accurate As an example of what this changes, the following code: let x: [int ..4]; Currently spits out ‘expected `]`, found `..`’. However, a comma would also be valid there, as would a number of other tokens. This change adjusts the parser to produce more accurate errors, so that that example now produces ‘expected one of `(`, `+`, `,`, `::`, or `]`, found `..`’.
2014-12-03 22:47:53 +13:00
fn
main
(
)
{
Recover and suggest use `;` to construct array type Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-14 04:28:20 +08:00
let
x
:
[
isize
3
]
;
//~ ERROR expected `;` or `]`, found `3`
Make the parser’s ‘expected <foo>, found <bar>’ errors more accurate As an example of what this changes, the following code: let x: [int ..4]; Currently spits out ‘expected `]`, found `..`’. However, a comma would also be valid there, as would a number of other tokens. This change adjusts the parser to produce more accurate errors, so that that example now produces ‘expected one of `(`, `+`, `,`, `::`, or `]`, found `..`’.
2014-12-03 22:47:53 +13:00
}
Reference in New Issue
Copy Permalink