1
1
use std:: cmp:: Ordering ;
2
2
3
+ use crate :: canonical:: * ;
3
4
use crate :: fold:: { TypeFoldable , TypeFolder , TypeSuperFoldable } ;
4
- use crate :: { canonical:: * , ConstTy , IntoKind , Placeholder } ;
5
5
use crate :: {
6
- BoundVar , ConstKind , DebruijnIndex , InferCtxtLike , Interner , RegionKind , TyKind , UniverseIndex ,
6
+ BoundVar , ConstKind , ConstTy , DebruijnIndex , InferCtxtLike , InferTy , Interner , IntoKind ,
7
+ Placeholder , RegionKind , TyKind , UniverseIndex ,
7
8
} ;
8
9
9
10
/// Whether we're canonicalizing a query input or the query response.
@@ -292,9 +293,16 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> for Canonica
292
293
let Err(ui) = self.infcx.probe_ty_var(vid) else {
293
294
panic!("ty var should have been resolved: {t}");
294
295
}; */
295
- CanonicalVarKind :: Ty ( CanonicalTyVarKind :: General (
296
- self . infcx . universe_of_ty ( i) . unwrap ( ) ,
297
- ) )
296
+ match i {
297
+ InferTy :: TyVar ( vid) => CanonicalVarKind :: Ty ( CanonicalTyVarKind :: General (
298
+ self . infcx . universe_of_ty ( vid) . unwrap ( ) ,
299
+ ) ) ,
300
+ InferTy :: IntVar ( _) => CanonicalVarKind :: Ty ( CanonicalTyVarKind :: Int ) ,
301
+ InferTy :: FloatVar ( _) => CanonicalVarKind :: Ty ( CanonicalTyVarKind :: Float ) ,
302
+ InferTy :: FreshTy ( _) | InferTy :: FreshIntTy ( _) | InferTy :: FreshFloatTy ( _) => {
303
+ todo ! ( )
304
+ }
305
+ }
298
306
}
299
307
TyKind :: Placeholder ( placeholder) => match self . canonicalize_mode {
300
308
CanonicalizeMode :: Input => CanonicalVarKind :: PlaceholderTy ( Placeholder :: new (
@@ -352,6 +360,7 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> for Canonica
352
360
I :: Const : TypeSuperFoldable < I > ,
353
361
{
354
362
let kind = match c. kind ( ) {
363
+ // TODO: This will not canonicalize effect vars until InferConst is uplifted.
355
364
ConstKind :: Infer ( i) => {
356
365
/* TODO: assert_eq!(
357
366
self.infcx.root_const_var(vid),
@@ -362,7 +371,13 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> for Canonica
362
371
panic!("const var should have been resolved");
363
372
}; */
364
373
// FIXME: we should fold this ty eventually
365
- CanonicalVarKind :: Const ( self . infcx . universe_of_ct ( i) . unwrap ( ) , c. ty ( ) )
374
+ match i {
375
+ crate :: InferConst :: Var ( vid) => {
376
+ CanonicalVarKind :: Const ( self . infcx . universe_of_ct ( vid) . unwrap ( ) , c. ty ( ) )
377
+ }
378
+ crate :: InferConst :: EffectVar ( _) => CanonicalVarKind :: Effect ,
379
+ crate :: InferConst :: Fresh ( _) => todo ! ( ) ,
380
+ }
366
381
}
367
382
ConstKind :: Placeholder ( placeholder) => match self . canonicalize_mode {
368
383
CanonicalizeMode :: Input => CanonicalVarKind :: PlaceholderConst (
0 commit comments