pub(in solve) fn predicates_for_object_candidate<D, I>(
ecx: &EvalCtxt<'_, D>,
param_env: I::ParamEnv,
trait_ref: TraitRef<I>,
object_bounds: I::BoundExistentialPredicates,
) -> Vec<Goal<I, I::Predicate>>where
D: SolverDelegate<Interner = I>,
I: Interner,
Expand description
Assemble a list of predicates that would be present on a theoretical user impl for an object type. These predicates must be checked any time we assemble a built-in object candidate for an object type, since they are not implied by the well-formedness of the type.
For example, given the following traits:
ⓘ
trait Foo: Baz {
type Bar: Copy;
}
trait Baz {}
For the dyn type dyn Foo<Item = Ty>
, we can imagine there being a
pair of theoretical impls:
ⓘ
impl Foo for dyn Foo<Item = Ty>
where
Self: Baz,
<Self as Foo>::Bar: Copy,
{
type Bar = Ty;
}
impl Baz for dyn Foo<Item = Ty> {}
However, in order to make such impls well-formed, we need to do an
additional step of eagerly folding the associated types in the where
clauses of the impl. In this example, that means replacing
<Self as Foo>::Bar
with Ty
in the first impl.