-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Confusing error when forgetting to include system crates in Cargo.toml #50373
Comments
This just showed up here in https://users.rust-lang.org/t/predictable-random-numbers/17593/11?u=exphp for a user trying to use |
I'm wondering how we feel about moving the error about rustc_private to a note and having the normal cannot find crate error be displayed? Generally speaking no one who's not working on the compiler cares about loading crates from the sysroot so that seems like a reasonable change. @rust-lang/compiler, any objections to this? We'd see something like this I imagine:
|
What if it didn't mention |
I think that would be reasonable in stable, but it would probably be nice to keep the message in nightly. |
Any updates here? I'm running into this error as we speak on nightly and it's very unclear what I'm meant to actually do. In this case it doesn't even point to a crate, but a macro:
So I don't even know what crate I'm missing.
The solution was to add a particular crate to my |
@banool I saw this error when I added |
This also happens while copying the example |
Should this be allowed at all? If you accidentally mention something from crates.io that is accidentally on your filesystem but is definitely not in your cargo.toml, should the compiler not just barf, and tell you to add it to cargo? I just got bit by this, and the error message that I needed was "You referenced Deserialize through serde-derive. This is provide by serde, but you have not added serde as a dependency. Add it, fool." |
Using a crate like
rand
without adding it to dependencies produces a long message:error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via 'Cargo.toml' instead? (see issue #27812)
etc.
This is pretty incomprehensible for a Rust beginner, compared to the normal error when failing to add a dependency:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: