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

Enhance E0463 "can't find crate" error message by hints indicating the starting point of a path to a solution. #89733

Open
emirror-de opened this issue Oct 10, 2021 · 1 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.

Comments

@emirror-de
Copy link

Given the following code: Playground Link

#![feature(plugin, core)]
#![plugin(phf_macros)]

fn main() {
    println!("hello world");
}

The current output is (for stable and nightly):

   Compiling playground v0.0.1 (/playground)
error[E0463]: can't find crate for `phf_macros`
 --> src/main.rs:2:11
  |
2 | #![plugin(phf_macros)]
  |           ^^^^^^^^^^ can't find crate

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

Ideally the output should look like:

   Compiling playground v0.0.1 (/playground)
error[E0463]: can't find crate for `phf_macros`
 --> src/main.rs:2:11
  |
2 | #![plugin(phf_macros)]
  |           ^^^^^^^^^^ can't find crate

Hints:
    - If using Cargo, double check your entry in `[dependencies]` section in Cargo.toml.
    - Check if the crate you want to use is present at crates.io.
    - When in a process of upgrading, double check the documentation of the crate you want to use.
      There may be a breaking change between the versions.

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

Maybe it would be nice to get something like a small checklist on how to address this issue? I filled the proposed output above with things that came to my mind (and by copying from rustc --explain E0463) while writing the issue.

@emirror-de emirror-de 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 Oct 10, 2021
@ThePuzzlemaker
Copy link
Contributor

It may be helpful to note that plugins have been deprecated for some time (and phf_macros no longer uses the interface), and #[feature(core)] has been stable for a long time.

This error still does occur with extern crate as indicated by the --explain output, however.

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

No branches or pull requests

2 participants