Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect warnings for path dependencies into one message printed at the end #8749

Open
jyn514 opened this issue Oct 3, 2020 · 0 comments
Open
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.

Comments

@jyn514
Copy link
Member

jyn514 commented Oct 3, 2020

Describe the problem you are trying to solve

In workspaces, especially very large workspaces, warnings are scattered around the output:

warning: publicly re-exporting an item from a different crate
  --> compiler/rustc_trait_selection/src/traits/mod.rs:73:1
   |
73 | pub use rustc_infer::traits::*;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: facade crates are discouraged; import from the original crate instead

warning: 42 warnings emitted

    Checking rustc_lint v0.0.0 (/home/joshua/rustc2/compiler/rustc_lint)
    Checking rustc_typeck v0.0.0 (/home/joshua/rustc2/compiler/rustc_typeck)
    Checking rustc_traits v0.0.0 (/home/joshua/rustc2/compiler/rustc_traits)
    Checking rustc_ty v0.0.0 (/home/joshua/rustc2/compiler/rustc_ty)
    Checking rustc_mir_build v0.0.0 (/home/joshua/rustc2/compiler/rustc_mir_build)
    Checking rustc_mir v0.0.0 (/home/joshua/rustc2/compiler/rustc_mir)
    Checking rustc_passes v0.0.0 (/home/joshua/rustc2/compiler/rustc_passes)
warning: unused import: `rustc_hir as hir`
 --> compiler/rustc_mir_build/src/build/expr/into.rs:9:5
  |
9 | use rustc_hir as hir;
  |     ^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

This makes it hard to see all the warnings; if there are enough crates being built they may disappear off the screen entirely and you might not see them at all.

Describe the solution you'd like

Cargo should print a sum of all the warnings at once: warning: 43 warnings emitted for all path dependencies. Since it uses --error-format=json --json=diagnostic-rendered-ansi this should be ~fairly easy to calculate from the rustc diagnostics, but don't quote me on that ;)

Ideally this wouldn't print warnings per-crate, just per-compile. However I'd rather have too much output than too little.

Notes

@joshtriplett suggested something like this in rust-lang/rust#77492 (comment), so I have a strong motivation to work on it myself if someone can write up mentoring instructions :)

@jyn514 jyn514 added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Oct 3, 2020
@ehuss ehuss added A-console-output Area: Terminal output, colors, progress bar, etc. A-diagnostics Area: Error and warning messages generated by Cargo itself. labels Oct 20, 2020
@epage epage added the S-triage Status: This issue is waiting on initial triage. label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

3 participants