11use std:: cmp:: Ordering ;
22
3+ use crate :: canonical:: * ;
34use crate :: fold:: { TypeFoldable , TypeFolder , TypeSuperFoldable } ;
4- use crate :: { canonical:: * , ConstTy , IntoKind , Placeholder } ;
55use crate :: {
6- BoundVar , ConstKind , DebruijnIndex , InferCtxtLike , Interner , RegionKind , TyKind , UniverseIndex ,
6+ BoundVar , ConstKind , ConstTy , DebruijnIndex , InferCtxtLike , InferTy , Interner , IntoKind ,
7+ Placeholder , RegionKind , TyKind , UniverseIndex ,
78} ;
89
910/// 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
292293 let Err(ui) = self.infcx.probe_ty_var(vid) else {
293294 panic!("ty var should have been resolved: {t}");
294295 }; */
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+ }
298306 }
299307 TyKind :: Placeholder ( placeholder) => match self . canonicalize_mode {
300308 CanonicalizeMode :: Input => CanonicalVarKind :: PlaceholderTy ( Placeholder :: new (
@@ -352,6 +360,7 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> for Canonica
352360 I :: Const : TypeSuperFoldable < I > ,
353361 {
354362 let kind = match c. kind ( ) {
363+ // TODO: This will not canonicalize effect vars until InferConst is uplifted.
355364 ConstKind :: Infer ( i) => {
356365 /* TODO: assert_eq!(
357366 self.infcx.root_const_var(vid),
@@ -362,7 +371,13 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I> for Canonica
362371 panic!("const var should have been resolved");
363372 }; */
364373 // 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+ }
366381 }
367382 ConstKind :: Placeholder ( placeholder) => match self . canonicalize_mode {
368383 CanonicalizeMode :: Input => CanonicalVarKind :: PlaceholderConst (
0 commit comments