-
Notifications
You must be signed in to change notification settings - Fork 13.3k
bad span on character literal errors #9149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Looks like there's a lot of spots in the lexer where the reported span is the last valid token instead of the offending token. Of the handful |
ben0x539
added a commit
to ben0x539/rust
that referenced
this issue
Sep 18, 2013
Previously, the lexer calling `rdr.fatal(...)` would report the span of the last complete token, instead of a span within the erroneous token (besides one span fixed in 1ac90bb). This commit adds a few wrappers around `rdr.fatal(...)` that set the span based on the `StringReader`'s state, give or take, so that all fatal errors in `libsyntax/parse/lexer.rs` can now report the offending code more precisely. A number of tests try to verify that, though the `compile-fail` testing setup can only check that the spans are on the right lines, and the "unterminated string/block comment" errors can't have the line marked at all, so that's incomplete. Closes rust-lang#9149.
Merged
bors
added a commit
that referenced
this issue
Sep 20, 2013
Previously, the lexer calling `rdr.fatal(...)` would report the span of the last complete token, instead of a span within the erroneous token (besides one span fixed in 1ac90bb). This branch adds wrappers around `rdr.fatal(...)` that sets the span explicilty, so that all fatal errors in `libsyntax/parse/lexer.rs` now report the offending code more precisely. A number of tests try to verify that, though the `compile-fail` testing setup can only check that the spans are on the right lines, and the "unterminated string/block comment" errors can't have the line marked at all, so that's incomplete. This closes #9149. Also, the lexer errors now report the offending code in the error message, not just via the span, just like other errors do.
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Jul 18, 2022
change applicability type to MaybeIncorrect in `explicit_counter_loop` close rust-lang#9013 This PR changes applicability type to `MaybeIncorrect`, because the suggestion is not `MachineApplicable`. changelog: change applicability type to MaybeIncorrect in `explicit_counter_loop`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When reporting the span for the error it chooses the previous line. This is quite confusing. The error here is that the
'\U...'
syntax takes exaclty 8 hex digits and 7 are provided.This test program:
produces this output from rustc
The text was updated successfully, but these errors were encountered: