Skip to content

"unknown start of token" error message is really bad #3747

Closed
@catamorphism

Description

@catamorphism
use std::list;
?use vec;

fn main() {}

This yields:

../src/test/compile-fail/bad-token-use.rs:1:13: 1:14 error: unknown start of token: 63
../src/test/compile-fail/bad-token-use.rs:1 use std::list;
                                                         ^

This is bad in a few different ways:

  1. "unknown start of token" is obscure, and why can't it print out '?' instead of 63?
  2. The error message does not show the erroneous code.
  3. The span is messed-up.
  4. I ran into this with a file in rustc, and in that case, the error message was much worse: the span was line 1 of rustc.rc. Panic-inducing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-frontendArea: Compiler frontend (errors, parsing and HIR)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions