Skip to content

Diagnostics sometimes suggest items from rustc_private crates #135232

Closed
@tgross35

Description

@tgross35

Code

This requires a compiler_builtins that includes a public or possibly public (i.e. feature gated) trait. The most recent v0.1.142 has this on Windows only (attempted update in #135180), I have a patched branch that makes this trait available on all platforms https://github.com/tgross35/rust/tree/experiment-builtins-math.

trait Trait { type Bar; }
type Foo = dyn Trait<F = i32, Bar = i32>;

Current output

Running rustc +stage0 foo.rs --crate-type=lib

--> foo.rs:6:22
  |
6 | type Foo = dyn Trait<F = i32, Bar = i32>;
  |                      ^ there is a similarly named associated type `H` in the trait `compiler_builtins::math::libm::support::int_traits::DInt`

Desired output

Don't suggest using compiler_builtins unless the crate is #![feature(rustc_private)]

Rationale and extra context

My investigation on Zulip https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Why.20do.20diagnostics.20suggest.20compiler_builtins

Rust Version

Current stage0

rustc 1.84.0-beta.1 (b4297a573 2024-11-26)
binary: rustc
commit-hash: b4297a573b4eefacd62e7ea1ba071536282d3254
commit-date: 2024-11-26
host: x86_64-unknown-linux-gnu
release: 1.84.0-beta.1
LLVM version: 19.1.4

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.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