Unify cargo and rustc's error reporting #86854
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-cargo
Relevant to the cargo team, which will review and decide on the PR/issue.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
The current output is:
Ideally the output should look like:
Right now, cargo and rustc operate basically independently of each other. The summary ("aborting ..." and "could not compile ...") is repeated twice, and both have different, incompatible ways to get more info about what went wrong. There's no reason to repeat these twice; we could include all the same information in half the space if we can get cargo and rustc to cooperate.
I suggest the way this be implemented is by keeping rustc's output the same when run standalone, but omitting "aborting due to ..." and "for more information ..." when run with
--error-format=json
. Then cargo can aggregate the info it used to print into its own errors by using the JSON output.cc @rust-lang/cargo @rust-lang/wg-diagnostics
(meta note: I thought of this while working on #86022, which has fully 12 lines of "metadata" after the 5 line error. Most builds are not that bad in comparison, but I do think it shows that it needs support from all the tools in the stack to keep the verbosity down.)
The text was updated successfully, but these errors were encountered: