+ })) if v.0.iter().all(|did| {
+ // FIXME: we should check `self_ty` against the receiver
+ // type in the `UnifyReceiver` context, but for now, use
+ // this imperfect proxy. This will fail if there are
+ // multiple `impl`s for the same trait like
+ // `impl Foo for Box<dyn Bar>` and `impl Foo for dyn Bar`.
+ // In that case, only the first one will get suggestions.
+ let mut hir_v = HirTraitObjectVisitor(vec![], *did);
+ hir_v.visit_ty(self_ty);
+ !hir_v.0.is_empty()
+ }) =>
+ {
+ Some(self_ty)
+ }