11use  super :: { InferCtxt ,  FixupError ,  FixupResult ,  Span } ; 
22use  super :: type_variable:: { TypeVariableOrigin ,  TypeVariableOriginKind } ; 
33use  crate :: mir:: interpret:: ConstValue ; 
4- use  crate :: ty:: { self ,  Ty ,  Const ,  TyCtxt ,  TypeFoldable ,  InferConst ,   TypeFlags } ; 
4+ use  crate :: ty:: { self ,  Ty ,  Const ,  TyCtxt ,  TypeFoldable ,  InferConst } ; 
55use  crate :: ty:: fold:: { TypeFolder ,  TypeVisitor } ; 
66
77/////////////////////////////////////////////////////////////////////////// 
@@ -29,7 +29,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, 'tcx> {
2929    } 
3030
3131    fn  fold_ty ( & mut  self ,  t :  Ty < ' tcx > )  -> Ty < ' tcx >  { 
32-         if  !t. has_infer_types ( )  { 
32+         if  !t. has_infer_types ( )  && !t . has_infer_consts ( )   { 
3333            t // micro-optimize -- if there is nothing in this type that this fold affects... 
3434        }  else  { 
3535            let  t = self . infcx . shallow_resolve ( t) ; 
@@ -38,7 +38,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticVarResolver<'a, 'tcx> {
3838    } 
3939
4040    fn  fold_const ( & mut  self ,  ct :  & ' tcx  Const < ' tcx > )  -> & ' tcx  Const < ' tcx >  { 
41-         if  !ct. has_type_flags ( TypeFlags :: HAS_CT_INFER )  { 
41+         if  !ct. has_infer_consts ( )  { 
4242            ct // micro-optimize -- if there is nothing in this const that this fold affects... 
4343        }  else  { 
4444            let  ct = self . infcx . shallow_resolve ( ct) ; 
0 commit comments