Add tcx.visible_traits()
and use it for producing diagnostics
Add an alternative to `tcx.all_traits()` that only shows traits that the user might be able to use, for diagnostic purposes. With this available, make use of it for diagnostics including associated type errors, which is part of the problem with [1]. Includes a few comment updates for related API. [1]: https://github.com/rust-lang/rust/issues/135232
This commit is contained in:
parent
9c34253762
commit
2da9accab9
5 changed files with 23 additions and 4 deletions
|
@ -179,7 +179,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
// all visible traits. If there's one clear winner, just suggest that.
|
||||
|
||||
let visible_traits: Vec<_> = tcx
|
||||
.all_traits()
|
||||
.visible_traits()
|
||||
.filter(|trait_def_id| {
|
||||
let viz = tcx.visibility(*trait_def_id);
|
||||
let def_id = self.item_def_id();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue