66use crate :: hir:: def:: Namespace ;
77use crate :: mir:: ProjectionKind ;
88use crate :: mir:: interpret:: ConstValue ;
9- use crate :: ty:: { self , Lift , Ty , TyCtxt , ConstVid } ;
9+ use crate :: ty:: { self , Lift , Ty , TyCtxt , ConstVid , InferConst } ;
1010use crate :: ty:: fold:: { TypeFoldable , TypeFolder , TypeVisitor } ;
1111use crate :: ty:: print:: { FmtPrinter , Printer } ;
1212use rustc_data_structures:: indexed_vec:: { IndexVec , Idx } ;
@@ -1352,8 +1352,7 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
13521352 fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , folder : & mut F ) -> Self {
13531353 match * self {
13541354 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) ) ,
13571356 ConstValue :: Param ( p) => ConstValue :: Param ( p. fold_with ( folder) ) ,
13581357 ConstValue :: Placeholder ( p) => ConstValue :: Placeholder ( p) ,
13591358 ConstValue :: Scalar ( a) => ConstValue :: Scalar ( a) ,
@@ -1366,8 +1365,7 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
13661365 fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> bool {
13671366 match * self {
13681367 ConstValue :: ByRef ( ..) => false ,
1369- // FIXME(const_generics): implement TypeFoldable for InferConst
1370- ConstValue :: Infer ( _) => false ,
1368+ ConstValue :: Infer ( ic) => ic. visit_with ( visitor) ,
13711369 ConstValue :: Param ( p) => p. visit_with ( visitor) ,
13721370 ConstValue :: Placeholder ( _) => false ,
13731371 ConstValue :: Scalar ( _) => false ,
@@ -1376,3 +1374,13 @@ impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> {
13761374 }
13771375 }
13781376}
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