@@ -25,7 +25,7 @@ use crate::traits::query::{Fallible, NoSolution};
25
25
use crate :: traits:: TraitEngine ;
26
26
use crate :: traits:: { Obligation , ObligationCause , PredicateObligation } ;
27
27
use crate :: ty:: fold:: TypeFoldable ;
28
- use crate :: ty:: subst:: { Kind , UnpackedKind } ;
28
+ use crate :: ty:: subst:: { GenericArg , GenericArgKind } ;
29
29
use crate :: ty:: { self , BoundVar , InferConst , Ty , TyCtxt } ;
30
30
use crate :: util:: captures:: Captures ;
31
31
@@ -298,11 +298,14 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
298
298
& v. var_values [ BoundVar :: new ( index) ]
299
299
} ) ;
300
300
match ( original_value. unpack ( ) , result_value. unpack ( ) ) {
301
- ( UnpackedKind :: Lifetime ( ty:: ReErased ) , UnpackedKind :: Lifetime ( ty:: ReErased ) ) => {
302
- // no action needed
301
+ (
302
+ GenericArgKind :: Lifetime ( ty:: ReErased ) ,
303
+ GenericArgKind :: Lifetime ( ty:: ReErased ) ,
304
+ ) => {
305
+ // No action needed.
303
306
}
304
307
305
- ( UnpackedKind :: Lifetime ( v_o) , UnpackedKind :: Lifetime ( v_r) ) => {
308
+ ( GenericArgKind :: Lifetime ( v_o) , GenericArgKind :: Lifetime ( v_r) ) => {
306
309
// To make `v_o = v_r`, we emit `v_o: v_r` and `v_r: v_o`.
307
310
if v_o != v_r {
308
311
output_query_region_constraints
@@ -314,12 +317,12 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
314
317
}
315
318
}
316
319
317
- ( UnpackedKind :: Type ( v1) , UnpackedKind :: Type ( v2) ) => {
320
+ ( GenericArgKind :: Type ( v1) , GenericArgKind :: Type ( v2) ) => {
318
321
let ok = self . at ( cause, param_env) . eq ( v1, v2) ?;
319
322
obligations. extend ( ok. into_obligations ( ) ) ;
320
323
}
321
324
322
- ( UnpackedKind :: Const ( v1) , UnpackedKind :: Const ( v2) ) => {
325
+ ( GenericArgKind :: Const ( v1) , GenericArgKind :: Const ( v2) ) => {
323
326
let ok = self . at ( cause, param_env) . eq ( v1, v2) ?;
324
327
obligations. extend ( ok. into_obligations ( ) ) ;
325
328
}
@@ -462,14 +465,14 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
462
465
// is directly equal to one of the canonical variables in the
463
466
// result, then we can type the corresponding value from the
464
467
// input. See the example above.
465
- let mut opt_values: IndexVec < BoundVar , Option < Kind < ' tcx > > > =
468
+ let mut opt_values: IndexVec < BoundVar , Option < GenericArg < ' tcx > > > =
466
469
IndexVec :: from_elem_n ( None , query_response. variables . len ( ) ) ;
467
470
468
471
// In terms of our example above, we are iterating over pairs like:
469
472
// [(?A, Vec<?0>), ('static, '?1), (?B, ?0)]
470
473
for ( original_value, result_value) in original_values. var_values . iter ( ) . zip ( result_values) {
471
474
match result_value. unpack ( ) {
472
- UnpackedKind :: Type ( result_value) => {
475
+ GenericArgKind :: Type ( result_value) => {
473
476
// e.g., here `result_value` might be `?0` in the example above...
474
477
if let ty:: Bound ( debruijn, b) = result_value. kind {
475
478
// ...in which case we would set `canonical_vars[0]` to `Some(?U)`.
@@ -479,7 +482,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
479
482
opt_values[ b. var ] = Some ( * original_value) ;
480
483
}
481
484
}
482
- UnpackedKind :: Lifetime ( result_value) => {
485
+ GenericArgKind :: Lifetime ( result_value) => {
483
486
// e.g., here `result_value` might be `'?1` in the example above...
484
487
if let & ty:: RegionKind :: ReLateBound ( debruijn, br) = result_value {
485
488
// ... in which case we would set `canonical_vars[0]` to `Some('static)`.
@@ -489,7 +492,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
489
492
opt_values[ br. assert_bound_var ( ) ] = Some ( * original_value) ;
490
493
}
491
494
}
492
- UnpackedKind :: Const ( result_value) => {
495
+ GenericArgKind :: Const ( result_value) => {
493
496
if let ty:: Const {
494
497
val : ConstValue :: Infer ( InferConst :: Canonical ( debrujin, b) ) ,
495
498
..
@@ -553,7 +556,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
553
556
// canonical variable; this is taken from
554
557
// `query_response.var_values` after applying the substitution
555
558
// `result_subst`.
556
- let substituted_query_response = |index : BoundVar | -> Kind < ' tcx > {
559
+ let substituted_query_response = |index : BoundVar | -> GenericArg < ' tcx > {
557
560
query_response. substitute_projected ( self . tcx , & result_subst, |v| & v. var_values [ index] )
558
561
} ;
559
562
@@ -586,17 +589,17 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
586
589
cause. clone ( ) ,
587
590
param_env,
588
591
match k1. unpack ( ) {
589
- UnpackedKind :: Lifetime ( r1) => ty:: Predicate :: RegionOutlives (
592
+ GenericArgKind :: Lifetime ( r1) => ty:: Predicate :: RegionOutlives (
590
593
ty:: Binder :: bind (
591
594
ty:: OutlivesPredicate ( r1, r2)
592
595
)
593
596
) ,
594
- UnpackedKind :: Type ( t1) => ty:: Predicate :: TypeOutlives (
597
+ GenericArgKind :: Type ( t1) => ty:: Predicate :: TypeOutlives (
595
598
ty:: Binder :: bind (
596
599
ty:: OutlivesPredicate ( t1, r2)
597
600
)
598
601
) ,
599
- UnpackedKind :: Const ( ..) => {
602
+ GenericArgKind :: Const ( ..) => {
600
603
// Consts cannot outlive one another, so we don't expect to
601
604
// ecounter this branch.
602
605
span_bug ! ( cause. span, "unexpected const outlives {:?}" , constraint) ;
@@ -613,29 +616,29 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
613
616
cause : & ObligationCause < ' tcx > ,
614
617
param_env : ty:: ParamEnv < ' tcx > ,
615
618
variables1 : & OriginalQueryValues < ' tcx > ,
616
- variables2 : impl Fn ( BoundVar ) -> Kind < ' tcx > ,
619
+ variables2 : impl Fn ( BoundVar ) -> GenericArg < ' tcx > ,
617
620
) -> InferResult < ' tcx , ( ) > {
618
621
self . commit_if_ok ( |_| {
619
622
let mut obligations = vec ! [ ] ;
620
623
for ( index, value1) in variables1. var_values . iter ( ) . enumerate ( ) {
621
624
let value2 = variables2 ( BoundVar :: new ( index) ) ;
622
625
623
626
match ( value1. unpack ( ) , value2. unpack ( ) ) {
624
- ( UnpackedKind :: Type ( v1) , UnpackedKind :: Type ( v2) ) => {
627
+ ( GenericArgKind :: Type ( v1) , GenericArgKind :: Type ( v2) ) => {
625
628
obligations
626
629
. extend ( self . at ( cause, param_env) . eq ( v1, v2) ?. into_obligations ( ) ) ;
627
630
}
628
631
(
629
- UnpackedKind :: Lifetime ( ty:: ReErased ) ,
630
- UnpackedKind :: Lifetime ( ty:: ReErased ) ,
632
+ GenericArgKind :: Lifetime ( ty:: ReErased ) ,
633
+ GenericArgKind :: Lifetime ( ty:: ReErased ) ,
631
634
) => {
632
635
// no action needed
633
636
}
634
- ( UnpackedKind :: Lifetime ( v1) , UnpackedKind :: Lifetime ( v2) ) => {
637
+ ( GenericArgKind :: Lifetime ( v1) , GenericArgKind :: Lifetime ( v2) ) => {
635
638
obligations
636
639
. extend ( self . at ( cause, param_env) . eq ( v1, v2) ?. into_obligations ( ) ) ;
637
640
}
638
- ( UnpackedKind :: Const ( v1) , UnpackedKind :: Const ( v2) ) => {
641
+ ( GenericArgKind :: Const ( v1) , GenericArgKind :: Const ( v2) ) => {
639
642
let ok = self . at ( cause, param_env) . eq ( v1, v2) ?;
640
643
obligations. extend ( ok. into_obligations ( ) ) ;
641
644
}
0 commit comments