@@ -25,7 +25,7 @@ use crate::traits::query::{Fallible, NoSolution};
2525use crate :: traits:: TraitEngine ;
2626use crate :: traits:: { Obligation , ObligationCause , PredicateObligation } ;
2727use crate :: ty:: fold:: TypeFoldable ;
28- use crate :: ty:: subst:: { Kind , UnpackedKind } ;
28+ use crate :: ty:: subst:: { GenericArg , GenericArgKind } ;
2929use crate :: ty:: { self , BoundVar , InferConst , Ty , TyCtxt } ;
3030use crate :: util:: captures:: Captures ;
3131
@@ -298,11 +298,14 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
298298 & v. var_values [ BoundVar :: new ( index) ]
299299 } ) ;
300300 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.
303306 }
304307
305- ( UnpackedKind :: Lifetime ( v_o) , UnpackedKind :: Lifetime ( v_r) ) => {
308+ ( GenericArgKind :: Lifetime ( v_o) , GenericArgKind :: Lifetime ( v_r) ) => {
306309 // To make `v_o = v_r`, we emit `v_o: v_r` and `v_r: v_o`.
307310 if v_o != v_r {
308311 output_query_region_constraints
@@ -314,12 +317,12 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
314317 }
315318 }
316319
317- ( UnpackedKind :: Type ( v1) , UnpackedKind :: Type ( v2) ) => {
320+ ( GenericArgKind :: Type ( v1) , GenericArgKind :: Type ( v2) ) => {
318321 let ok = self . at ( cause, param_env) . eq ( v1, v2) ?;
319322 obligations. extend ( ok. into_obligations ( ) ) ;
320323 }
321324
322- ( UnpackedKind :: Const ( v1) , UnpackedKind :: Const ( v2) ) => {
325+ ( GenericArgKind :: Const ( v1) , GenericArgKind :: Const ( v2) ) => {
323326 let ok = self . at ( cause, param_env) . eq ( v1, v2) ?;
324327 obligations. extend ( ok. into_obligations ( ) ) ;
325328 }
@@ -462,14 +465,14 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
462465 // is directly equal to one of the canonical variables in the
463466 // result, then we can type the corresponding value from the
464467 // 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 > > > =
466469 IndexVec :: from_elem_n ( None , query_response. variables . len ( ) ) ;
467470
468471 // In terms of our example above, we are iterating over pairs like:
469472 // [(?A, Vec<?0>), ('static, '?1), (?B, ?0)]
470473 for ( original_value, result_value) in original_values. var_values . iter ( ) . zip ( result_values) {
471474 match result_value. unpack ( ) {
472- UnpackedKind :: Type ( result_value) => {
475+ GenericArgKind :: Type ( result_value) => {
473476 // e.g., here `result_value` might be `?0` in the example above...
474477 if let ty:: Bound ( debruijn, b) = result_value. kind {
475478 // ...in which case we would set `canonical_vars[0]` to `Some(?U)`.
@@ -479,7 +482,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
479482 opt_values[ b. var ] = Some ( * original_value) ;
480483 }
481484 }
482- UnpackedKind :: Lifetime ( result_value) => {
485+ GenericArgKind :: Lifetime ( result_value) => {
483486 // e.g., here `result_value` might be `'?1` in the example above...
484487 if let & ty:: RegionKind :: ReLateBound ( debruijn, br) = result_value {
485488 // ... in which case we would set `canonical_vars[0]` to `Some('static)`.
@@ -489,7 +492,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
489492 opt_values[ br. assert_bound_var ( ) ] = Some ( * original_value) ;
490493 }
491494 }
492- UnpackedKind :: Const ( result_value) => {
495+ GenericArgKind :: Const ( result_value) => {
493496 if let ty:: Const {
494497 val : ConstValue :: Infer ( InferConst :: Canonical ( debrujin, b) ) ,
495498 ..
@@ -553,7 +556,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
553556 // canonical variable; this is taken from
554557 // `query_response.var_values` after applying the substitution
555558 // `result_subst`.
556- let substituted_query_response = |index : BoundVar | -> Kind < ' tcx > {
559+ let substituted_query_response = |index : BoundVar | -> GenericArg < ' tcx > {
557560 query_response. substitute_projected ( self . tcx , & result_subst, |v| & v. var_values [ index] )
558561 } ;
559562
@@ -586,17 +589,17 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
586589 cause. clone ( ) ,
587590 param_env,
588591 match k1. unpack ( ) {
589- UnpackedKind :: Lifetime ( r1) => ty:: Predicate :: RegionOutlives (
592+ GenericArgKind :: Lifetime ( r1) => ty:: Predicate :: RegionOutlives (
590593 ty:: Binder :: bind (
591594 ty:: OutlivesPredicate ( r1, r2)
592595 )
593596 ) ,
594- UnpackedKind :: Type ( t1) => ty:: Predicate :: TypeOutlives (
597+ GenericArgKind :: Type ( t1) => ty:: Predicate :: TypeOutlives (
595598 ty:: Binder :: bind (
596599 ty:: OutlivesPredicate ( t1, r2)
597600 )
598601 ) ,
599- UnpackedKind :: Const ( ..) => {
602+ GenericArgKind :: Const ( ..) => {
600603 // Consts cannot outlive one another, so we don't expect to
601604 // ecounter this branch.
602605 span_bug ! ( cause. span, "unexpected const outlives {:?}" , constraint) ;
@@ -613,29 +616,29 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
613616 cause : & ObligationCause < ' tcx > ,
614617 param_env : ty:: ParamEnv < ' tcx > ,
615618 variables1 : & OriginalQueryValues < ' tcx > ,
616- variables2 : impl Fn ( BoundVar ) -> Kind < ' tcx > ,
619+ variables2 : impl Fn ( BoundVar ) -> GenericArg < ' tcx > ,
617620 ) -> InferResult < ' tcx , ( ) > {
618621 self . commit_if_ok ( |_| {
619622 let mut obligations = vec ! [ ] ;
620623 for ( index, value1) in variables1. var_values . iter ( ) . enumerate ( ) {
621624 let value2 = variables2 ( BoundVar :: new ( index) ) ;
622625
623626 match ( value1. unpack ( ) , value2. unpack ( ) ) {
624- ( UnpackedKind :: Type ( v1) , UnpackedKind :: Type ( v2) ) => {
627+ ( GenericArgKind :: Type ( v1) , GenericArgKind :: Type ( v2) ) => {
625628 obligations
626629 . extend ( self . at ( cause, param_env) . eq ( v1, v2) ?. into_obligations ( ) ) ;
627630 }
628631 (
629- UnpackedKind :: Lifetime ( ty:: ReErased ) ,
630- UnpackedKind :: Lifetime ( ty:: ReErased ) ,
632+ GenericArgKind :: Lifetime ( ty:: ReErased ) ,
633+ GenericArgKind :: Lifetime ( ty:: ReErased ) ,
631634 ) => {
632635 // no action needed
633636 }
634- ( UnpackedKind :: Lifetime ( v1) , UnpackedKind :: Lifetime ( v2) ) => {
637+ ( GenericArgKind :: Lifetime ( v1) , GenericArgKind :: Lifetime ( v2) ) => {
635638 obligations
636639 . extend ( self . at ( cause, param_env) . eq ( v1, v2) ?. into_obligations ( ) ) ;
637640 }
638- ( UnpackedKind :: Const ( v1) , UnpackedKind :: Const ( v2) ) => {
641+ ( GenericArgKind :: Const ( v1) , GenericArgKind :: Const ( v2) ) => {
639642 let ok = self . at ( cause, param_env) . eq ( v1, v2) ?;
640643 obligations. extend ( ok. into_obligations ( ) ) ;
641644 }
0 commit comments