5
5
6
6
use crate :: mir:: ProjectionKind ;
7
7
use crate :: mir:: interpret:: ConstValue ;
8
- use crate :: ty:: { self , Lift , Ty , TyCtxt } ;
8
+ use crate :: ty:: { self , Lift , Ty , TyCtxt , ConstVid , InferConst } ;
9
9
use crate :: ty:: fold:: { TypeFoldable , TypeFolder , TypeVisitor } ;
10
10
use rustc_data_structures:: indexed_vec:: { IndexVec , Idx } ;
11
11
use smallvec:: SmallVec ;
12
12
use crate :: mir:: interpret;
13
13
14
+ use std:: marker:: PhantomData ;
14
15
use std:: rc:: Rc ;
15
16
16
17
///////////////////////////////////////////////////////////////////////////
@@ -49,6 +50,7 @@ CloneTypeFoldableAndLiftImpls! {
49
50
crate :: ty:: BoundRegion ,
50
51
crate :: ty:: ClosureKind ,
51
52
crate :: ty:: IntVarValue ,
53
+ crate :: ty:: ParamConst ,
52
54
crate :: ty:: ParamTy ,
53
55
crate :: ty:: UniverseIndex ,
54
56
crate :: ty:: Variance ,
@@ -503,6 +505,14 @@ impl<'a, 'tcx> Lift<'tcx> for ConstValue<'a> {
503
505
type Lifted = ConstValue < ' tcx > ;
504
506
fn lift_to_tcx < ' b , ' gcx > ( & self , tcx : TyCtxt < ' b , ' gcx , ' tcx > ) -> Option < Self :: Lifted > {
505
507
match * self {
508
+ ConstValue :: Param ( param) => Some ( ConstValue :: Param ( param) ) ,
509
+ ConstValue :: Infer ( infer) => {
510
+ Some ( ConstValue :: Infer ( match infer {
511
+ InferConst :: Var ( vid) => InferConst :: Var ( vid. lift_to_tcx ( tcx) ?) ,
512
+ InferConst :: Fresh ( i) => InferConst :: Fresh ( i) ,
513
+ InferConst :: Canonical ( debrujin, var) => InferConst :: Canonical ( debrujin, var) ,
514
+ } ) )
515
+ }
506
516
ConstValue :: Scalar ( x) => Some ( ConstValue :: Scalar ( x) ) ,
507
517
ConstValue :: Slice ( x, y) => Some ( ConstValue :: Slice ( x, y) ) ,
508
518
ConstValue :: ByRef ( ptr, alloc) => Some ( ConstValue :: ByRef (
@@ -512,6 +522,16 @@ impl<'a, 'tcx> Lift<'tcx> for ConstValue<'a> {
512
522
}
513
523
}
514
524
525
+ impl < ' a , ' tcx > Lift < ' tcx > for ConstVid < ' a > {
526
+ type Lifted = ConstVid < ' tcx > ;
527
+ fn lift_to_tcx < ' b , ' gcx > ( & self , _: TyCtxt < ' b , ' gcx , ' tcx > ) -> Option < Self :: Lifted > {
528
+ Some ( ConstVid {
529
+ index : self . index ,
530
+ phantom : PhantomData ,
531
+ } )
532
+ }
533
+ }
534
+
515
535
///////////////////////////////////////////////////////////////////////////
516
536
// TypeFoldable implementations.
517
537
//
0 commit comments