1
Fork 0

Fix associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty

This commit is contained in:
Santiago Pastorino 2023-06-23 18:18:05 -03:00
parent 54d6738a8d
commit 6d997876c1
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
6 changed files with 110 additions and 14 deletions

View file

@ -122,9 +122,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let all_candidate_names: Vec<_> = all_candidates()
.flat_map(|r| self.tcx().associated_items(r.def_id()).in_definition_order())
.filter_map(
|item| if item.kind == ty::AssocKind::Type { Some(item.name) } else { None },
)
.filter_map(|item| {
if item.opt_rpitit_info.is_none() && item.kind == ty::AssocKind::Type {
Some(item.name)
} else {
None
}
})
.collect();
if let (Some(suggested_name), true) = (
@ -159,9 +163,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
.flat_map(|trait_def_id| {
self.tcx().associated_items(*trait_def_id).in_definition_order()
})
.filter_map(
|item| if item.kind == ty::AssocKind::Type { Some(item.name) } else { None },
)
.filter_map(|item| {
if item.opt_rpitit_info.is_none() && item.kind == ty::AssocKind::Type {
Some(item.name)
} else {
None
}
})
.collect();
if let (Some(suggested_name), true) = (