File tree 2 files changed +20
-10
lines changed
compiler/rustc_middle/src/ty
2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,13 @@ pub trait TypeFolder<'tcx>: Sized {
263
263
c. super_fold_with ( self )
264
264
}
265
265
266
+ fn fold_unevaluated ( & mut self , uv : ty:: Unevaluated < ' tcx > ) -> ty:: Unevaluated < ' tcx >
267
+ where
268
+ Self : TypeFolder < ' tcx , Error = !> ,
269
+ {
270
+ uv. super_fold_with ( self )
271
+ }
272
+
266
273
fn fold_predicate ( & mut self , p : ty:: Predicate < ' tcx > ) -> ty:: Predicate < ' tcx >
267
274
where
268
275
Self : TypeFolder < ' tcx , Error = !> ,
@@ -305,6 +312,13 @@ pub trait FallibleTypeFolder<'tcx>: TypeFolder<'tcx> {
305
312
c. try_super_fold_with ( self )
306
313
}
307
314
315
+ fn try_fold_unevaluated (
316
+ & mut self ,
317
+ c : ty:: Unevaluated < ' tcx > ,
318
+ ) -> Result < ty:: Unevaluated < ' tcx > , Self :: Error > {
319
+ c. try_super_fold_with ( self )
320
+ }
321
+
308
322
fn try_fold_predicate (
309
323
& mut self ,
310
324
p : ty:: Predicate < ' tcx > ,
Original file line number Diff line number Diff line change @@ -1228,6 +1228,10 @@ impl<'tcx> TypeFoldable<'tcx> for InferConst<'tcx> {
1228
1228
}
1229
1229
1230
1230
impl < ' tcx > TypeFoldable < ' tcx > for ty:: Unevaluated < ' tcx > {
1231
+ fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
1232
+ folder. try_fold_unevaluated ( self )
1233
+ }
1234
+
1231
1235
fn try_super_fold_with < F : FallibleTypeFolder < ' tcx > > (
1232
1236
self ,
1233
1237
folder : & mut F ,
@@ -1253,19 +1257,11 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Unevaluated<'tcx, ()> {
1253
1257
self ,
1254
1258
folder : & mut F ,
1255
1259
) -> Result < Self , F :: Error > {
1256
- Ok ( ty:: Unevaluated {
1257
- def : self . def ,
1258
- substs : self . substs . try_fold_with ( folder) ?,
1259
- promoted : self . promoted ,
1260
- } )
1261
- }
1262
-
1263
- fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
1264
- visitor. visit_unevaluated ( self . expand ( ) )
1260
+ Ok ( self . expand ( ) . try_fold_with ( folder) ?. shrink ( ) )
1265
1261
}
1266
1262
1267
1263
fn super_visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
1268
- self . substs . visit_with ( visitor)
1264
+ self . expand ( ) . visit_with ( visitor)
1269
1265
}
1270
1266
}
1271
1267
You can’t perform that action at this time.
0 commit comments