cargo-deny icon indicating copy to clipboard operation
cargo-deny copied to clipboard

Improve crate error spans

Open Jake-Shadle opened this issue 5 years ago • 4 comments

Currently, if a diagnostic pertains to a specific crate (or crates in the case of duplicates), the primary label for it is usually the entry in a synthesized lockfile, which is just the name, version, and source of the crate in question. This isn't really terribly useful, it was mainly done this way due the requirement of codespan_reporting to have a primary label for a "source" span. A better way to display such diagnostics would be to instead follow the dependency links to a root crate(s) in the workspace, and use the line in that crate's cargo manifest that included the crate in question transitively as the primary label, and if additional crates in the workspace at the same level as that root also depend on it, adding those as additional labels. For most projects this will be a more meaningful primary label than the current output.

Jake-Shadle avatar Feb 13 '20 12:02 Jake-Shadle

Oh, this would also probably include things like using the license expression as it appears in the cargo manifest as well, rather than the synthesized one we use now.

Jake-Shadle avatar Feb 13 '20 12:02 Jake-Shadle

I just noticed that cargo-deny uses codespan! As a heads-up, in the next version we won't require a primary span, so hopefully this makes things easier for you!

brendanzab avatar Mar 06 '20 11:03 brendanzab

Nice, looking forward to it! Codespan is a great library!

Jake-Shadle avatar Mar 06 '20 13:03 Jake-Shadle

Getting ready to release 0.9.0! https://github.com/brendanzab/codespan/pull/199

brendanzab avatar Mar 11 '20 05:03 brendanzab