Skip to content

Should include crate name in error message for E0391 (and perhaps others)  #74380

@pnkfelix

Description

@pnkfelix

While doing a bootstrap build of the compiler with some other build artifacts lying around, I saw the following error message (a small snippet from whole output):

[RUSTC-TIMING] cfg_if test:false 0.035
   Compiling lock_api v0.3.4
[RUSTC-TIMING] scopeguard test:false 0.068
   Compiling crossbeam-utils v0.6.5
   Compiling tracing-core v0.1.10
   Compiling log_settings v0.1.2
error[E0391]: cycle detected when running analysis passes on this crate
  |
  = note: ...which again requires running analysis passes on this crate, completing the cycle

error: aborting due to previous error

For more information about this error, try `rustc --explain E0391`.
error[E0391]: cycle detected when running analysis passes on this crate
  |
  = note: ...which again requires running analysis passes on this crate, completing the cycle

[RUSTC-TIMING] lazy_static test:false 0.079
error: aborting due to previous error

It is sub-optimal to say "on this crate" in a diagnostic like this.

Multiple crates can be compiled in parallel, and thus it can be ambiguous which crate a diagnostic like that is associated with.

In general it would be better to extract a crate name, if possible, and include that in the message, rather than using the simpler-but-potentially-ambiguous "on this crate."

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.T-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