Skip to content

Commit 3d23937

Browse files
Add assertions back to canonicalizer
1 parent 90064c3 commit 3d23937

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

compiler/rustc_next_trait_solver/src/canonicalizer.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::cmp::Ordering;
22

33
use rustc_type_ir::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
4+
use rustc_type_ir::visit::{Flags, TypeVisitableExt};
45
use 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

Comments
 (0)