6
6
use crate :: hir:: def:: Namespace ;
7
7
use crate :: mir:: ProjectionKind ;
8
8
use crate :: mir:: interpret:: ConstValue ;
9
- use crate :: ty:: { self , Lift , Ty , TyCtxt , ConstVid } ;
9
+ use crate :: ty:: { self , Lift , Ty , TyCtxt , ConstVid , InferConst } ;
10
10
use crate :: ty:: fold:: { TypeFoldable , TypeFolder , TypeVisitor } ;
11
11
use crate :: ty:: print:: { FmtPrinter , Printer } ;
12
12
use rustc_data_structures:: indexed_vec:: { IndexVec , Idx } ;
@@ -1352,8 +1352,7 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
1352
1352
fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , folder : & mut F ) -> Self {
1353
1353
match * self {
1354
1354
ConstValue :: ByRef ( ptr, alloc) => ConstValue :: ByRef ( ptr, alloc) ,
1355
- // FIXME(const_generics): implement TypeFoldable for InferConst
1356
- ConstValue :: Infer ( ic) => ConstValue :: Infer ( ic) ,
1355
+ ConstValue :: Infer ( ic) => ConstValue :: Infer ( ic. fold_with ( folder) ) ,
1357
1356
ConstValue :: Param ( p) => ConstValue :: Param ( p. fold_with ( folder) ) ,
1358
1357
ConstValue :: Placeholder ( p) => ConstValue :: Placeholder ( p) ,
1359
1358
ConstValue :: Scalar ( a) => ConstValue :: Scalar ( a) ,
@@ -1366,8 +1365,7 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
1366
1365
fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
1367
1366
match * self {
1368
1367
ConstValue :: ByRef ( ..) => false ,
1369
- // FIXME(const_generics): implement TypeFoldable for InferConst
1370
- ConstValue :: Infer ( _) => false ,
1368
+ ConstValue :: Infer ( ic) => ic. visit_with ( visitor) ,
1371
1369
ConstValue :: Param ( p) => p. visit_with ( visitor) ,
1372
1370
ConstValue :: Placeholder ( _) => false ,
1373
1371
ConstValue :: Scalar ( _) => false ,
@@ -1376,3 +1374,13 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
1376
1374
}
1377
1375
}
1378
1376
}
1377
+
1378
+ impl < ' tcx > TypeFoldable < ' tcx > for InferConst < ' tcx > {
1379
+ fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , _folder : & mut F ) -> Self {
1380
+ * self
1381
+ }
1382
+
1383
+ fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , _visitor : & mut V ) -> bool {
1384
+ false
1385
+ }
1386
+ }
0 commit comments