Skip to content

Better associate rustc diagnostics to crate #8977

Open
@dtolnay

Description

I am seeing an unfortunate phenomenon where, since I have a lot of crates that are used in a lot of projects, statistically it happens very often that Cargo prints "Compiling [one of my crates]" immediately followed by a compiler diagnostic from some totally unrelated crate. The user sees something like the following and understands it to mean that the error occurred while compiling quote, which is true in a sense because the crates are compiling in parallel, but quite misleading.

$ cargo build
...
   Compiling quote v1.0.7
error[E0412]: cannot find type `DeviceState` in this scope
  --> /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/device_query-0.2.7/src/lib.rs:39:22
   |
39 | impl DeviceQuery for DeviceState {
   |                      ^^^^^^^^^^^ not found in this scope

I have been seeing a rising number of misdirected bug reports on my crates due to this behavior.

I think it would help a lot if Cargo could guarantee that compiler diagnostics were always printed below "Compiling [that exact crate]" (or equivalently labeled in some way), even if it means double-printing "Compiling [that exact crate]" or some terminal UI hack.

Metadata

Assignees

No one assigned

    Labels

    A-console-outputArea: Terminal output, colors, progress bar, etc.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions