@@ -34,7 +34,7 @@ use super::InferCtxt;
3434use rustc_data_structures:: fx:: FxHashMap ;
3535use rustc_middle:: infer:: unify_key:: ToType ;
3636use rustc_middle:: ty:: fold:: TypeFolder ;
37- use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeFoldable } ;
37+ use rustc_middle:: ty:: { self , Ty , TyCtxt , TypeFoldable , TypeSuperFoldable } ;
3838use std:: collections:: hash_map:: Entry ;
3939
4040pub struct TypeFreshener < ' a , ' tcx > {
@@ -228,12 +228,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
228228 . probe_value ( v)
229229 . val
230230 . known ( ) ;
231- return self . freshen_const (
232- opt_ct,
233- ty:: InferConst :: Var ( v) ,
234- ty:: InferConst :: Fresh ,
235- ct. ty ( ) ,
236- ) ;
231+ self . freshen_const ( opt_ct, ty:: InferConst :: Var ( v) , ty:: InferConst :: Fresh , ct. ty ( ) )
237232 }
238233 ty:: ConstKind :: Infer ( ty:: InferConst :: Fresh ( i) ) => {
239234 if i >= self . const_freshen_count {
@@ -244,7 +239,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
244239 self . const_freshen_count,
245240 ) ;
246241 }
247- return ct ;
242+ ct
248243 }
249244
250245 ty:: ConstKind :: Bound ( ..) | ty:: ConstKind :: Placeholder ( _) => {
@@ -254,9 +249,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
254249 ty:: ConstKind :: Param ( _)
255250 | ty:: ConstKind :: Value ( _)
256251 | ty:: ConstKind :: Unevaluated ( ..)
257- | ty:: ConstKind :: Error ( _) => { }
252+ | ty:: ConstKind :: Error ( _) => ct . super_fold_with ( self ) ,
258253 }
259-
260- ct. super_fold_with ( self )
261254 }
262255}
0 commit comments