For E0223, suggest associated functions that are similar to the path, even if there are multiple inherent impls to check.
This commit is contained in:
parent
b2728d5426
commit
6702df109e
1 changed files with 6 additions and 4 deletions
|
@ -999,11 +999,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||||
..
|
..
|
||||||
}) = node
|
}) = node
|
||||||
&& let Some(adt_def) = qself_ty.ty_adt_def()
|
&& let Some(adt_def) = qself_ty.ty_adt_def()
|
||||||
&& let [inherent_impl] = tcx.inherent_impls(adt_def.did())
|
&& let name = Symbol::intern(&format!("{ident2}_{ident3}"))
|
||||||
&& let name = format!("{ident2}_{ident3}")
|
|
||||||
&& let Some(ty::AssocItem { kind: ty::AssocKind::Fn, .. }) = tcx
|
&& let Some(ty::AssocItem { kind: ty::AssocKind::Fn, .. }) = tcx
|
||||||
.associated_items(inherent_impl)
|
.inherent_impls(adt_def.did())
|
||||||
.filter_by_name_unhygienic(Symbol::intern(&name))
|
.iter()
|
||||||
|
.flat_map(|inherent_impl| {
|
||||||
|
tcx.associated_items(inherent_impl).filter_by_name_unhygienic(name)
|
||||||
|
})
|
||||||
.next()
|
.next()
|
||||||
{
|
{
|
||||||
Err(struct_span_code_err!(self.dcx(), span, E0223, "ambiguous associated type")
|
Err(struct_span_code_err!(self.dcx(), span, E0223, "ambiguous associated type")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue