Skip to content

Rust suggests unstable paths for non-imported item #78130

Open
@carbotaniuman

Description

@carbotaniuman
pub fn main() {
    println!("{}", size_of_val(&5))
}

(Playground)

   Compiling playground v0.0.1 (/playground)
error[E0425]: cannot find function `size_of_val` in this scope
 --> src/main.rs:2:20
  |
2 |     println!("{}", size_of_val(&5))
  |                    ^^^^^^^^^^^ not found in this scope
  |
help: consider importing one of these items
  |
1 | use core::intrinsics::size_of_val;
  |
1 | use core::mem::size_of_val;
  |
1 | use futures_core::core_reexport::intrinsics::size_of_val;
  |
1 | use futures_core::core_reexport::mem::size_of_val;
  |
    and 7 other candidates

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
error: could not compile `playground`.

To learn more, run the command again with --verbose.

I expected rustc to only show me paths that are stable if I'm on a stable compiler, but I also get suggestions to intrinsics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyA-stabilityArea: `#[stable]`, `#[unstable]` etc.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-papercutDiagnostics: An error or lint that needs small tweaks.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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