Closed
Description
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
- Clone this repo
- Run
rustup default nightly
- 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.