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

cargo check --message-format json regression of error span data on empty main.rs file #68808

Closed
Veetaha opened this issue Feb 3, 2020 · 4 comments · Fixed by #70199
Closed
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Veetaha
Copy link
Contributor

Veetaha commented Feb 3, 2020

Problem
cargo check --message-format json returns invalid span data, particularly line_end and line_start are set to 0, though it is guaranteed to be 1-based.
This happens with a completly empty main.rs file.

Tested on the following cargo version:
cargo 1.42.0-nightly (9d32b7b01 2020-01-26)

Whilst on the stable version the returned span array is empty:
cargo 1.41.0 (626f0f40e 2019-12-03)

Steps

  1. Clone this repo
  2. Run rustup default nightly
  3. Run cargo check --message-format json > check.json

Now you can see invalid span in check.json file.

I've already created and formatted check-1.41.json and check-1.42.json files with the output of different cargo versions.
Here are the crutial differences 1.41 and 1.42

Context
The issue was initially reported at rust-analyzer project repo here.

@Veetaha Veetaha changed the title cargo check --message-fromat json regression of error span data on empty main.rs file cargo check --message-format json regression of error span data on empty main.rs file Feb 3, 2020
@ehuss ehuss transferred this issue from rust-lang/cargo Feb 3, 2020
@ehuss
Copy link
Contributor

ehuss commented Feb 3, 2020

Moved to rust-lang/rust, where diagnostics live.

Seems to be caused by #67770, cc @Centril.

@estebank estebank added A-parser Area: The parsing of Rust source code to an AST. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints and removed A-parser Area: The parsing of Rust source code to an AST. labels Feb 3, 2020
@Veetaha
Copy link
Contributor Author

Veetaha commented Feb 3, 2020

@Centril additional info:
The regression is also present on the older version of nightly rustc:
rustc 1.42.0-nightly (b5a3341f1 2020-01-20)

This was the version where I initially spotted the issue, then updated and rechecked, but it was still present in cargo 1.42.0-nightly (9d32b7b01 2020-01-26).

@Centril
Copy link
Contributor

Centril commented Feb 3, 2020

Probably caused by 20ebb80.

@pnkfelix
Copy link
Member

pnkfelix commented Feb 6, 2020

triage: P-high. Assigning to self.

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 P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants