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

Better diagnostic for missing components #87871

Closed
antoyo opened this issue Aug 8, 2021 · 0 comments · Fixed by #88830
Closed

Better diagnostic for missing components #87871

antoyo opened this issue Aug 8, 2021 · 0 comments · Fixed by #88830
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@antoyo
Copy link
Contributor

antoyo commented Aug 8, 2021

When using the rustc_private feature without the components being installed and you use a compiler crate, you'll get an error like this:

can't find crate for `rustc_metadata`

which is not helpful.

Given the following code:

#![feature(rustc_private)]

extern crate rustc_metadata;

fn main() {
}

The current output is:

error[E0463]: can't find crate for `rustc_metadata`
 --> src/main.rs:4:1
  |
4 | extern crate rustc_metadata;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `metadata-reader` due to previous error

Ideally the output should look like:

error[E0463]: can't find crate for `rustc_metadata`
 --> src/main.rs:4:1
  |
4 | extern crate rustc_metadata;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `metadata-reader` due to previous error
help: maybe you need to install the following components: rust-src rustc-dev llvm-tools-preview

(the last line was added, specifying what could be done to fix the issue)

cc @GuillaumeGomez

@antoyo antoyo added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 8, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 11, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Sep 11, 2021
@bors bors closed this as completed in 2cfafa6 Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant