Skip to content

Import trait help message is incorrect #114884

Closed
@disconnect3d

Description

@disconnect3d

Code

extern crate rustc_index;

use rustc_index::{vec::Idx};

fn main() { }

Current output

# rustc --version
rustc 1.73.0-nightly (0bdb00d55 2023-08-15)

# rustc main.rs
error[E0603]: module `vec` is private
 --> main.rs:3:19
  |
3 | use rustc_index::{vec::Idx};
  |                   ^^^ private module
  |
note: the module `vec` is defined here
 --> /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/compiler/rustc_index/src/lib.rs:24:1
help: consider importing this trait instead
  |
3 | use rustc_index::{rustc_index::Idx};
  |                   ~~~~~~~~~~~~~~~~

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?
 --> main.rs:1:1
  |
1 | extern crate rustc_index;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = 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

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0603, E0658.
For more information about an error, try `rustc --explain E0603`.

(The rustc_private error is irrelevant)

Desired output

The suggestion to import rustc_index::{rustc_index::Idx}; is obviously wrong. It should be rustc_index::{Idx}; (or even rustc_index::Idx).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.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