@@ -148,7 +148,7 @@ impl<I: Interner> TypeVisitor<I> for OutlivesCollector<'_, I> {
148
148
// trait-ref. Therefore, if we see any higher-ranked regions,
149
149
// we simply fallback to the most restrictive rule, which
150
150
// requires that `Pi: 'a` for all `i`.
151
- ty:: Alias ( _ , alias_ty) => {
151
+ ty:: Alias ( kind , alias_ty) => {
152
152
if !alias_ty. has_escaping_bound_vars ( ) {
153
153
// best case: no escaping regions, so push the
154
154
// projection and skip the subtree (thus generating no
@@ -162,7 +162,7 @@ impl<I: Interner> TypeVisitor<I> for OutlivesCollector<'_, I> {
162
162
// OutlivesProjectionComponents. Continue walking
163
163
// through and constrain Pi.
164
164
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) ;
166
166
self . out . push ( Component :: EscapingAlias ( subcomponents. into_iter ( ) . collect ( ) ) ) ;
167
167
}
168
168
}
@@ -217,21 +217,17 @@ impl<I: Interner> TypeVisitor<I> for OutlivesCollector<'_, I> {
217
217
}
218
218
}
219
219
220
- /// Collect [Component]s for *all* the args of `parent `.
220
+ /// Collect [Component]s for *all* the args of `alias_ty `.
221
221
///
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.
223
223
/// Use [push_outlives_components] instead.
224
224
pub fn compute_alias_components_recursive < I : Interner > (
225
225
cx : I ,
226
- alias_ty : I :: Ty ,
226
+ kind : ty:: AliasTyKind ,
227
+ alias_ty : ty:: AliasTy < I > ,
227
228
out : & mut SmallVec < [ Component < I > ; 4 ] > ,
228
229
) {
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 ) ;
235
231
236
232
let mut visitor = OutlivesCollector { cx, out, visited : Default :: default ( ) } ;
237
233
0 commit comments