pub fn expand_trait_aliases<'tcx>(
tcx: TyCtxt<'tcx>,
clauses: impl IntoIterator<Item = (Clause<'tcx>, Span)>,
) -> (Vec<(PolyTraitPredicate<'tcx>, SmallVec<[Span; 1]>)>, Vec<(PolyProjectionPredicate<'tcx>, Span)>)
Expand description
Return the trait and projection predicates that come from eagerly expanding the trait aliases in the list of clauses. For each trait predicate, record a stack of spans that trace from the user-written trait alias bound. For projection predicates, just record the span of the projection itself.
For trait aliases, we don’t deduplicte the predicates, since we currently do not consider duplicated traits as a single trait for the purposes of our “one trait principal” restriction; however, for projections we do deduplicate them.
ⓘ
trait Bar {}
trait Foo = Bar + Bar;
let dyn_incompatible: dyn Foo; // bad, two `Bar` principals.