Skip to content

unexpected token: <eof> although it's not eof, but eoi #112458

Closed
@hellow554

Description

@hellow554

Code

fn main() {
    println!("", x.);
}

Current output

error: unexpected token: `<eof>`
 --> src/main.rs:2:19
  |
2 |     println!("", x.);
  |                   ^

Desired output

error: unexpected token: `)`
 --> src/main.rs:2:19
  |
2 |     println!("", x.);
  |                    ^

Rationale and extra context

While I fully understand, why it is saying <eof>, I'm not sure if this can be improved, e.g. if the subparser says eof but the current parser has a character at that position, it could say which one it is.
Also the spike ^ points to the "eof" of the macro input, which can be improved I guess.

If we remove the !, it is exactly what I'd like to see:

error: unexpected token: `)`
 --> src/main.rs:2:19
  |
2 |     println("", x.);
  |                   ^

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions