Skip to content

Don't print name resolution errors if a crate fails to load #96799

Open
@jyn514

Description

@jyn514

Given the following code: 7342286

The current output is: several hundred thousand lines long. https://github.com/rust-lang/rust/runs/6331341497?check_suite_focus=true#step:26:783

Ideally the output should look like: not that. Just the errors about crate loading:

error[E0464]: multiple matching crates for `core`
   --> /cargo/registry/src/github.com-1ecc6299db9ec823/scopeguard-1.1.0/src/lib.rs:192:1
    |
192 | extern crate core as std;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: candidates:
            crate `core`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-19a6c7cb160f2c97.rmeta
            crate `core`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-7d5425aa48f72471.rlib

The failures from name resolution are almost always because of unresolved imports from the missing crate, and showing them hurts more than it helps.

@rustbot label +A-resolve

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions