Skip to content

Confusing error when forgetting to include system crates in Cargo.toml #50373

Open
@steven807

Description

@steven807

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:

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

Meta

rustc --version --verbose:

% rustc --version --verbose
rustc 1.27.0-nightly (79252ff4e 2018-04-29)
binary: rustc
commit-hash: 79252ff4e25d82f9fe856cb66f127b79cdace163
commit-date: 2018-04-29
host: x86_64-apple-darwin
release: 1.27.0-nightly
LLVM version: 6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.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