@@ -407,11 +407,18 @@ impl<'a, D: SolverDelegate<Interner = I>, I: Interner> Canonicalizer<'a, D, I> {
407407 "ty vid should have been resolved fully before canonicalization"
408408 ) ;
409409
410- CanonicalVarKind :: Ty ( CanonicalTyVarKind :: General (
411- self . delegate
412- . universe_of_ty ( vid)
413- . unwrap_or_else ( || panic ! ( "ty var should have been resolved: {t:?}" ) ) ,
414- ) )
410+ match self . canonicalize_mode {
411+ CanonicalizeMode :: Input { .. } => CanonicalVarKind :: Ty (
412+ CanonicalTyVarKind :: General ( ty:: UniverseIndex :: ROOT ) ,
413+ ) ,
414+ CanonicalizeMode :: Response { .. } => {
415+ CanonicalVarKind :: Ty ( CanonicalTyVarKind :: General (
416+ self . delegate . universe_of_ty ( vid) . unwrap_or_else ( || {
417+ panic ! ( "ty var should have been resolved: {t:?}" )
418+ } ) ,
419+ ) )
420+ }
421+ }
415422 }
416423 ty:: IntVar ( vid) => {
417424 debug_assert_eq ! (
@@ -435,7 +442,7 @@ impl<'a, D: SolverDelegate<Interner = I>, I: Interner> Canonicalizer<'a, D, I> {
435442 } ,
436443 ty:: Placeholder ( placeholder) => match self . canonicalize_mode {
437444 CanonicalizeMode :: Input { .. } => CanonicalVarKind :: PlaceholderTy (
438- PlaceholderLike :: new_anon ( placeholder . universe ( ) , self . variables . len ( ) . into ( ) ) ,
445+ PlaceholderLike :: new_anon ( ty :: UniverseIndex :: ROOT , self . variables . len ( ) . into ( ) ) ,
439446 ) ,
440447 CanonicalizeMode :: Response { .. } => CanonicalVarKind :: PlaceholderTy ( placeholder) ,
441448 } ,
@@ -588,13 +595,21 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for Canonicaliz
588595 c,
589596 "const vid should have been resolved fully before canonicalization"
590597 ) ;
591- CanonicalVarKind :: Const ( self . delegate . universe_of_ct ( vid) . unwrap ( ) )
598+
599+ match self . canonicalize_mode {
600+ CanonicalizeMode :: Input { .. } => {
601+ CanonicalVarKind :: Const ( ty:: UniverseIndex :: ROOT )
602+ }
603+ CanonicalizeMode :: Response { .. } => {
604+ CanonicalVarKind :: Const ( self . delegate . universe_of_ct ( vid) . unwrap ( ) )
605+ }
606+ }
592607 }
593608 ty:: InferConst :: Fresh ( _) => todo ! ( ) ,
594609 } ,
595610 ty:: ConstKind :: Placeholder ( placeholder) => match self . canonicalize_mode {
596611 CanonicalizeMode :: Input { .. } => CanonicalVarKind :: PlaceholderConst (
597- PlaceholderLike :: new_anon ( placeholder . universe ( ) , self . variables . len ( ) . into ( ) ) ,
612+ PlaceholderLike :: new_anon ( ty :: UniverseIndex :: ROOT , self . variables . len ( ) . into ( ) ) ,
598613 ) ,
599614 CanonicalizeMode :: Response { .. } => {
600615 CanonicalVarKind :: PlaceholderConst ( placeholder)
0 commit comments