Skip to content
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

Line numbers are truncated in diagnostics. #67431

Closed
kevincox opened this issue Dec 19, 2019 · 8 comments
Closed

Line numbers are truncated in diagnostics. #67431

kevincox opened this issue Dec 19, 2019 · 8 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kevincox
Copy link
Contributor

kevincox commented Dec 19, 2019

Some, but not all, diagnostics are truncating the line number to 2 digits.

Can we remove this truncation? It makes the most visible location for line numbers basically useless.

error[E0560]: struct `game::Table` has no field named `artifacts`
 --> src/game.rs:1452:4
  |
14|             artifacts: vec![None; state.players],
  |             ^^^^^^^^^ `game::Table` does not have this field
  |
  = note: available fields are: `shared_a_data`, `shared_b_data`, `shared_c_data`, `shared_d_data`, `shared_e_data` ... and 3 others

Note that the correct line number is 1452, however next to the code it displays 14.

@kevincox
Copy link
Contributor Author

Note that some diagnostics output the line number correctly:

error[E0063]: missing fields `happiness`, `sanity` in initializer of `game::Game`
    --> src/game.rs:1492:18
     |
1492 |         let mut game = Game {
     |                        ^^^^ missing `happiness`, `sanity`

error: aborting due to 7 previous errors

@Mark-Simulacrum
Copy link
Member

cc @estebank

Do you happen to have a more minimal example?

@Mark-Simulacrum Mark-Simulacrum added A-diagnostics Area: Messages for errors, warnings, and lints E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 19, 2019
@kevincox
Copy link
Contributor Author

I tried reproducing on the playground with no luck. I'll see if I can get a minimal example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=47795d540db43935a85384ea7dc91249.

cargo build is enough to reproduce on my project.

@estebank
Copy link
Contributor

estebank commented Dec 19, 2019

What version are you on? Also, is there a repo you can share with a reproduction?

@kevincox
Copy link
Contributor Author

kevincox commented Dec 19, 2019

% cargo version
cargo 1.40.0-nightly (8b0561d68 2019-09-30)
% rustc --version
rustc 1.40.0-nightly (2daa404e9 2019-10-02)

@wesleywiser
Copy link
Member

I believe this was fixed the day after that nightly (see #65001).

@estebank
Copy link
Contributor

@kevincox could you rustup update to a newer nightly (or stable) to verify whether this is indeed the same issue which has been already fixed?

@kevincox
Copy link
Contributor Author

Ah, PEBKAC. I didn't realize that I had pinned an exact version of nightly for that directory. I've updated and the issue doesn't appear to be occurring anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants