cargo check --message-format json regression of error span data on empty main.rs file #68808
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.
Problem
cargo check --message-format json
returns invalid span data, particularlyline_end
andline_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
rustup default nightly
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
andcheck-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.
The text was updated successfully, but these errors were encountered: