@@ -148,7 +148,7 @@ impl<I: Interner> TypeVisitor<I> for OutlivesCollector<'_, I> {
148148 // trait-ref. Therefore, if we see any higher-ranked regions,
149149 // we simply fallback to the most restrictive rule, which
150150 // requires that `Pi: 'a` for all `i`.
151- ty:: Alias ( _ , alias_ty) => {
151+ ty:: Alias ( kind , alias_ty) => {
152152 if !alias_ty. has_escaping_bound_vars ( ) {
153153 // best case: no escaping regions, so push the
154154 // projection and skip the subtree (thus generating no
@@ -162,7 +162,7 @@ impl<I: Interner> TypeVisitor<I> for OutlivesCollector<'_, I> {
162162 // OutlivesProjectionComponents. Continue walking
163163 // through and constrain Pi.
164164 let mut subcomponents = smallvec ! [ ] ;
165- compute_alias_components_recursive ( self . cx , ty , & mut subcomponents) ;
165+ compute_alias_components_recursive ( self . cx , kind , alias_ty , & mut subcomponents) ;
166166 self . out . push ( Component :: EscapingAlias ( subcomponents. into_iter ( ) . collect ( ) ) ) ;
167167 }
168168 }
@@ -217,21 +217,17 @@ impl<I: Interner> TypeVisitor<I> for OutlivesCollector<'_, I> {
217217 }
218218}
219219
220- /// Collect [Component]s for *all* the args of `parent `.
220+ /// Collect [Component]s for *all* the args of `alias_ty `.
221221///
222- /// This should not be used to get the components of `parent ` itself.
222+ /// This should not be used to get the components of `alias_ty ` itself.
223223/// Use [push_outlives_components] instead.
224224pub fn compute_alias_components_recursive < I : Interner > (
225225 cx : I ,
226- alias_ty : I :: Ty ,
226+ kind : ty:: AliasTyKind ,
227+ alias_ty : ty:: AliasTy < I > ,
227228 out : & mut SmallVec < [ Component < I > ; 4 ] > ,
228229) {
229- let ty:: Alias ( kind, alias_ty) = alias_ty. kind ( ) else {
230- unreachable ! ( "can only call `compute_alias_components_recursive` on an alias type" )
231- } ;
232-
233- let opt_variances =
234- if kind == ty:: Opaque { Some ( cx. variances_of ( alias_ty. def_id ) ) } else { None } ;
230+ let opt_variances = cx. opt_alias_variances ( kind, alias_ty. def_id ) ;
235231
236232 let mut visitor = OutlivesCollector { cx, out, visited : Default :: default ( ) } ;
237233
0 commit comments