-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Diagnostics sometimes suggest items from rustc_private
crates
#135232
Comments
The context is that I did try making that change before rust-lang/compiler-builtins#656, which had to be reverted because of the failure at #128691 (comment). Didn't look into the cause too much at that time. But in any case, the current situation isn't very robust, and finding problems only at sync time is inconvenient. I can try to figure this out but I'm not sure where to start. @compiler-errors this seems like your territory, any suggestions? |
Also this only seems to apply to trait-related diagnostics, e.g. calling a function from fn main() {
__adddf3(1.0, 2.0);
} |
More reliable repro that works on stable and refers to trait Trait { type Bar; }
type Foo = dyn Trait<Buf = i32, Bar = i32>;
Looks like this might be easier than expected if this is the only kind of error, maybe just a filter at rust/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs Lines 201 to 209 in 0707499
|
For places where we don't want stdlib-private crates to be accessible, use `.visible_crates()` rather than `.crates()`. The current effect is that items in stdlib-private crates will no longer show up in diagnostics related to trait selection. Fixes: rust-lang#135232
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.Current output
Running
rustc +stage0 foo.rs --crate-type=lib
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
Anything else?
No response
The text was updated successfully, but these errors were encountered: