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

don't suggest feature(rustc_private) for std dependencies #112747

Closed
jyn514 opened this issue Jun 17, 2023 · 1 comment
Closed

don't suggest feature(rustc_private) for std dependencies #112747

jyn514 opened this issue Jun 17, 2023 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-metadata Area: Crate metadata A-stability Area: `#[stable]`, `#[unstable]` etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Jun 17, 2023

Code

// https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=00a9b664d929655758d33fc1469ee274
extern crate compiler_builtins;

Current output

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?
 --> src/lib.rs:2:1
  |
2 | extern crate compiler_builtins;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #27812 <https://github.com/rust-lang/rust/issues/27812> for more information
  = help: add `#![feature(rustc_private)]` to the crate attributes to enable

Desired output

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

Rationale and extra context

Dependencies of the standard library are an implementation details and shouldn't affect diagnostics. In particular, I saw a case in the wild where someone added extern crate libc; and got the false impression that libc was nightly-only; that could have been avoided with better diagnostics.

Note that I think we should still giving this message for crates whose name starts with rustc_ - those only show up when you have rustc-dev installed already, and the hint may be useful.

Other cases

No response

Anything else?

No response

@jyn514 jyn514 added A-diagnostics Area: Messages for errors, warnings, and lints A-metadata Area: Crate metadata A-stability Area: `#[stable]`, `#[unstable]` etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 17, 2023
@jyn514
Copy link
Member Author

jyn514 commented Jun 17, 2023

duplicate of #50373 (comment)

@jyn514 jyn514 closed this as completed Jun 17, 2023
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 A-metadata Area: Crate metadata A-stability Area: `#[stable]`, `#[unstable]` etc. 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

1 participant