@@ -206,20 +206,16 @@ impl<'db> TypeSuperVisitable<DbInterner<'db>> for Const<'db> {
206
206
& self ,
207
207
visitor : & mut V ,
208
208
) -> V :: Result {
209
- match ( * self ) . kind ( ) {
210
- ConstKind :: Param ( p) => p. visit_with ( visitor) ,
211
- // FIXME(next-solver): need to add this impl upstream
212
- //ConstKind::Infer(i) => i.visit_with(visitor),
213
- ConstKind :: Infer ( i) => V :: Result :: output ( ) ,
214
- ConstKind :: Bound ( d, b) => {
215
- try_visit ! ( d. visit_with( visitor) ) ;
216
- b. visit_with ( visitor)
217
- }
218
- ConstKind :: Placeholder ( p) => p. visit_with ( visitor) ,
209
+ match self . kind ( ) {
219
210
ConstKind :: Unevaluated ( uv) => uv. visit_with ( visitor) ,
220
211
ConstKind :: Value ( v) => v. visit_with ( visitor) ,
221
- ConstKind :: Error ( e) => e. visit_with ( visitor) ,
222
212
ConstKind :: Expr ( e) => e. visit_with ( visitor) ,
213
+ ConstKind :: Error ( e) => e. visit_with ( visitor) ,
214
+
215
+ ConstKind :: Param ( _)
216
+ | ConstKind :: Infer ( _)
217
+ | ConstKind :: Bound ( ..)
218
+ | ConstKind :: Placeholder ( _) => V :: Result :: output ( ) ,
223
219
}
224
220
}
225
221
}
@@ -242,38 +238,34 @@ impl<'db> TypeSuperFoldable<DbInterner<'db>> for Const<'db> {
242
238
folder : & mut F ,
243
239
) -> Result < Self , F :: Error > {
244
240
let kind = match self . kind ( ) {
245
- ConstKind :: Param ( p) => ConstKind :: Param ( p. try_fold_with ( folder) ?) ,
246
- // FIXME(next-solver): need to add this impl upstream
247
- //ConstKind::Infer(i) => ConstKind::Infer(i.try_fold_with(folder)?),
248
- ConstKind :: Infer ( i) => ConstKind :: Infer ( i) ,
249
- ConstKind :: Bound ( d, b) => {
250
- ConstKind :: Bound ( d. try_fold_with ( folder) ?, b. try_fold_with ( folder) ?)
251
- }
252
- ConstKind :: Placeholder ( p) => ConstKind :: Placeholder ( p. try_fold_with ( folder) ?) ,
253
241
ConstKind :: Unevaluated ( uv) => ConstKind :: Unevaluated ( uv. try_fold_with ( folder) ?) ,
254
242
ConstKind :: Value ( v) => ConstKind :: Value ( v. try_fold_with ( folder) ?) ,
255
- ConstKind :: Error ( e) => ConstKind :: Error ( e. try_fold_with ( folder) ?) ,
256
243
ConstKind :: Expr ( e) => ConstKind :: Expr ( e. try_fold_with ( folder) ?) ,
244
+
245
+ ConstKind :: Param ( _)
246
+ | ConstKind :: Infer ( _)
247
+ | ConstKind :: Bound ( ..)
248
+ | ConstKind :: Placeholder ( _)
249
+ | ConstKind :: Error ( _) => return Ok ( self ) ,
257
250
} ;
258
- if kind != self . kind ( ) { Ok ( Const :: new ( folder. cx ( ) , kind) ) } else { Ok ( self ) }
251
+ if kind != self . kind ( ) { Ok ( folder. cx ( ) . mk_ct_from_kind ( kind) ) } else { Ok ( self ) }
259
252
}
260
253
fn super_fold_with < F : rustc_type_ir:: TypeFolder < DbInterner < ' db > > > (
261
254
self ,
262
255
folder : & mut F ,
263
256
) -> Self {
264
257
let kind = match self . kind ( ) {
265
- ConstKind :: Param ( p) => ConstKind :: Param ( p. fold_with ( folder) ) ,
266
- // FIXME(next-solver): need to add this impl upstream
267
- //ConstKind::Infer(i) => ConstKind::Infer(i.fold_with(folder)),
268
- ConstKind :: Infer ( i) => ConstKind :: Infer ( i) ,
269
- ConstKind :: Bound ( d, b) => ConstKind :: Bound ( d. fold_with ( folder) , b. fold_with ( folder) ) ,
270
- ConstKind :: Placeholder ( p) => ConstKind :: Placeholder ( p. fold_with ( folder) ) ,
271
258
ConstKind :: Unevaluated ( uv) => ConstKind :: Unevaluated ( uv. fold_with ( folder) ) ,
272
259
ConstKind :: Value ( v) => ConstKind :: Value ( v. fold_with ( folder) ) ,
273
- ConstKind :: Error ( e) => ConstKind :: Error ( e. fold_with ( folder) ) ,
274
260
ConstKind :: Expr ( e) => ConstKind :: Expr ( e. fold_with ( folder) ) ,
261
+
262
+ ConstKind :: Param ( _)
263
+ | ConstKind :: Infer ( _)
264
+ | ConstKind :: Bound ( ..)
265
+ | ConstKind :: Placeholder ( _)
266
+ | ConstKind :: Error ( _) => return self ,
275
267
} ;
276
- if kind != self . kind ( ) { Const :: new ( folder. cx ( ) , kind) } else { self }
268
+ if kind != self . kind ( ) { folder. cx ( ) . mk_ct_from_kind ( kind) } else { self }
277
269
}
278
270
}
279
271
0 commit comments