Skip to content

100s of irrelevant errors when a crate cannot be loaded #154096

@RalfJung

Description

@RalfJung

When something is wrong with the rustc setup and a key crate cannot be loaded (such as libstd, or one of the rustc_ crates when building a tool like Miri), there are 100s of error messages and most of them are useless. Specifically when building Miri without having the rustc_ crates, the first errors make sense:

error[E0463]: can't find crate for `rustc_abi`
  --> src/lib.rs:63:1
   |
63 | extern crate rustc_abi;
   | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
   |
   = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`

error[E0463]: can't find crate for `rustc_apfloat`
  --> src/lib.rs:64:1
   |
64 | extern crate rustc_apfloat;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
   |
   = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`

error[E0463]: can't find crate for `rustc_ast`
  --> src/lib.rs:65:1
   |
65 | extern crate rustc_ast;
   | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
   |
   = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`

error[E0463]: can't find crate for `rustc_codegen_ssa`
  --> src/lib.rs:66:1
   |
66 | extern crate rustc_codegen_ssa;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
   |
   = help: maybe you need to install the missing components with: `rustup component add rust-src rustc-dev llvm-tools-preview`

But then it goes on like this:

error[E0432]: unresolved imports `crate::InterpResult`, `crate::interp_ok`
 --> src/borrow_tracker/stacked_borrows/stack.rs:9:13
  |
9 | use crate::{InterpResult, ProvenanceExtra, interp_ok};
  |             ^^^^^^^^^^^^                   ^^^^^^^^^ no `interp_ok` in the root
  |             |
  |             no `InterpResult` in the root
  |
  = note: unresolved item `crate::concurrency::genmc::intercept::InterpResult` exists but is inaccessible

error[E0432]: unresolved import `InterpErrorKind`
   --> src/diagnostics.rs:234:9
    |
234 |     use InterpErrorKind::*;
    |         ^^^^^^^^^^^^^^^ use of undeclared type `InterpErrorKind`

error[E0432]: unresolved import `UndefinedBehaviorInfo`
   --> src/diagnostics.rs:235:9
    |
235 |     use UndefinedBehaviorInfo::*;
    |         ^^^^^^^^^^^^^^^^^^^^^ use of undeclared type `UndefinedBehaviorInfo`

error: cannot find macro `throw_machine_stop` in this scope
   --> src/alloc_addresses/mod.rs:375:17
    |
375 |                 throw_machine_stop!(TerminationInfo::Int2PtrWithStrictProvenance);
    |                 ^^^^^^^^^^^^^^^^^^

This goes on forever.

error: could not compile `miri` (lib) due to 282 previous errors; 2 warnings emitted

Instead I would expect rustc to stop after complaining about the missing crates; everything else is just useless noise.

(I was sure I already filed this as an issue but I couldn't find it...)

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions