Auto merge of #135278 - tgross35:ignore-std-dep-crates, r=SparrowLii
Exclude dependencies of `std` for diagnostics Currently crates in the sysroot can show up in diagnostic suggestions, such as in https://github.com/rust-lang/rust/issues/135232. To prevent this, duplicate `all_traits` into `visible_traits` which only shows traits in non-private crates. Setting `#![feature(rustc_private)]` overrides this and makes items in private crates visible as well, since `rustc_private` enables use of `std`'s private dependencies. This may be reviewed per-commit. Fixes: https://github.com/rust-lang/rust/issues/135232
This commit is contained in:
commit
8c39ce5b4f
11 changed files with 225 additions and 44 deletions
|
@ -2189,7 +2189,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
let required_trait_path = self.tcx.def_path_str(trait_ref.def_id());
|
||||
let traits_with_same_path: UnordSet<_> = self
|
||||
.tcx
|
||||
.all_traits()
|
||||
.visible_traits()
|
||||
.filter(|trait_def_id| *trait_def_id != trait_ref.def_id())
|
||||
.map(|trait_def_id| (self.tcx.def_path_str(trait_def_id), trait_def_id))
|
||||
.filter(|(p, _)| *p == required_trait_path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue