11use std:: cmp:: Ordering ;
22
33use rustc_type_ir:: fold:: { TypeFoldable , TypeFolder , TypeSuperFoldable } ;
4+ use rustc_type_ir:: visit:: { Flags , TypeVisitableExt } ;
45use rustc_type_ir:: {
56 self as ty, Canonical , CanonicalTyVarKind , CanonicalVarInfo , CanonicalVarKind , ConstTy ,
67 InferCtxtLike , Interner , IntoKind , PlaceholderLike ,
@@ -44,7 +45,13 @@ pub struct Canonicalizer<'a, Infcx: InferCtxtLike<Interner = I>, I: Interner> {
4445 binder_index : ty:: DebruijnIndex ,
4546}
4647
47- impl < ' a , Infcx : InferCtxtLike < Interner = I > , I : Interner > Canonicalizer < ' a , Infcx , I > {
48+ impl < ' a , Infcx : InferCtxtLike < Interner = I > , I : Interner > Canonicalizer < ' a , Infcx , I >
49+ where
50+ I :: Ty : Flags ,
51+ I :: Region : Flags ,
52+ I :: Const : Flags ,
53+ I :: Predicate : Flags ,
54+ {
4855 pub fn canonicalize < T : TypeFoldable < I > > (
4956 infcx : & ' a Infcx ,
5057 canonicalize_mode : CanonicalizeMode ,
@@ -62,8 +69,8 @@ impl<'a, Infcx: InferCtxtLike<Interner = I>, I: Interner> Canonicalizer<'a, Infc
6269
6370 let value = value. fold_with ( & mut canonicalizer) ;
6471 // FIXME: Restore these assertions. Should we uplift type flags?
65- // assert!(!value.has_infer(), "unexpected infer in {value:?}");
66- // assert!(!value.has_placeholders(), "unexpected placeholders in {value:?}");
72+ assert ! ( !value. has_infer( ) , "unexpected infer in {value:?}" ) ;
73+ assert ! ( !value. has_placeholders( ) , "unexpected placeholders in {value:?}" ) ;
6774
6875 let ( max_universe, variables) = canonicalizer. finalize ( ) ;
6976
0 commit comments