Rollup merge of #112983 - spastorino:new-rpitit-23, r=compiler-errors
Fix return type notation associated type suggestion when -Zlower-impl-trait-in-trait-to-assoc-ty This avoid suggesting the associated types generated for RPITITs when the one the code refers to doesn't exist and rustc looks for a suggestion. r? `@compiler-errors`
This commit is contained in:
commit
bfe6e5c418
6 changed files with 110 additions and 14 deletions
|
@ -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) = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue