1
1
use std:: cmp:: Ordering ;
2
2
3
3
use rustc_type_ir:: fold:: { TypeFoldable , TypeFolder , TypeSuperFoldable } ;
4
+ use rustc_type_ir:: visit:: { Flags , TypeVisitableExt } ;
4
5
use rustc_type_ir:: {
5
6
self as ty, Canonical , CanonicalTyVarKind , CanonicalVarInfo , CanonicalVarKind , ConstTy ,
6
7
InferCtxtLike , Interner , IntoKind , PlaceholderLike ,
@@ -44,7 +45,13 @@ pub struct Canonicalizer<'a, Infcx: InferCtxtLike<Interner = I>, I: Interner> {
44
45
binder_index : ty:: DebruijnIndex ,
45
46
}
46
47
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
+ {
48
55
pub fn canonicalize < T : TypeFoldable < I > > (
49
56
infcx : & ' a Infcx ,
50
57
canonicalize_mode : CanonicalizeMode ,
@@ -62,8 +69,8 @@ impl<'a, Infcx: InferCtxtLike<Interner = I>, I: Interner> Canonicalizer<'a, Infc
62
69
63
70
let value = value. fold_with ( & mut canonicalizer) ;
64
71
// 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:?}" ) ;
67
74
68
75
let ( max_universe, variables) = canonicalizer. finalize ( ) ;
69
76
0 commit comments