fn live_args_for_outlives_clause<'tcx>(
tcx: TyCtxt<'tcx>,
alias_def_id: DefId,
ty: Ty<'tcx>,
outlives: Binder<'tcx, TypeOutlivesPredicate<'tcx>>,
) -> Option<FxIndexSet<EarlyBinder<'tcx, GenericArg<'tcx>>>>Expand description
For a param-env clause for<'v..> <T as Trait>::Assoc<..>: 'bound that
applies to ty (an alias with alias_def_id), returns the set of (identity) args
that the underlying type could possibly capture, as restricted by this clause.
As an example, let’s imagine we had the following associated type definition:
type Assoc<'a, 'b, 'c: 'a> = (&'a &'c (), &'b ());the following clause:
for<'x, 'y> T::Assoc<'x, 'x, 'y>: 'xWe know from the clause alone that given some substitution of T:Assoc,
we know that it can capture either the first or the second region. However,
the bounds on the associated type itself additionally imply that the
third region can also be captured, because it outlives the first.
Now, let’s assume we had this clause:
for<'x, 'y> T::Assoc<'x, 'y, 'x>: 'xHere, we know that 'a and 'c could be captured, but there is no outlives
relationship to 'b for either of those, so the underlying type can’t
capture any arg containing 'b.
Note: because higher-ranked bounds don’t have implications, there will be
some cases (like for<'x, 'y, 'z> T::Assoc<'x, 'y, 'z>: 'x) that won’t
be satisfiable today, but the logic here should hold whenever there is.
Returns None if the clause doesn’t apply to ty or gives us no information.