@@ -268,7 +268,7 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I>
268268 ty:: ReVar ( vid) => {
269269 assert_eq ! (
270270 self . infcx. opportunistic_resolve_lt_var( vid) ,
271- None ,
271+ r ,
272272 "region vid should have been resolved fully before canonicalization"
273273 ) ;
274274 match self . canonicalize_mode {
@@ -302,13 +302,8 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I>
302302 ty:: Infer ( i) => match i {
303303 ty:: TyVar ( vid) => {
304304 assert_eq ! (
305- self . infcx. root_ty_var( vid) ,
306- vid,
307- "ty vid should have been resolved fully before canonicalization"
308- ) ;
309- assert_eq ! (
310- self . infcx. probe_ty_var( vid) ,
311- None ,
305+ self . infcx. opportunistic_resolve_ty_var( vid) ,
306+ t,
312307 "ty vid should have been resolved fully before canonicalization"
313308 ) ;
314309
@@ -318,10 +313,24 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I>
318313 . unwrap_or_else ( || panic ! ( "ty var should have been resolved: {t:?}" ) ) ,
319314 ) )
320315 }
321- ty:: IntVar ( _) => CanonicalVarKind :: Ty ( CanonicalTyVarKind :: Int ) ,
322- ty:: FloatVar ( _) => CanonicalVarKind :: Ty ( CanonicalTyVarKind :: Float ) ,
316+ ty:: IntVar ( vid) => {
317+ assert_eq ! (
318+ self . infcx. opportunistic_resolve_int_var( vid) ,
319+ t,
320+ "ty vid should have been resolved fully before canonicalization"
321+ ) ;
322+ CanonicalVarKind :: Ty ( CanonicalTyVarKind :: Int )
323+ }
324+ ty:: FloatVar ( vid) => {
325+ assert_eq ! (
326+ self . infcx. opportunistic_resolve_float_var( vid) ,
327+ t,
328+ "ty vid should have been resolved fully before canonicalization"
329+ ) ;
330+ CanonicalVarKind :: Ty ( CanonicalTyVarKind :: Float )
331+ }
323332 ty:: FreshTy ( _) | ty:: FreshIntTy ( _) | ty:: FreshFloatTy ( _) => {
324- todo ! ( )
333+ panic ! ( "fresh vars not expected in canonicalization" )
325334 }
326335 } ,
327336 ty:: Placeholder ( placeholder) => match self . canonicalize_mode {
@@ -387,14 +396,11 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I>
387396 let kind = match c. kind ( ) {
388397 ty:: ConstKind :: Infer ( i) => match i {
389398 ty:: InferConst :: Var ( vid) => {
399+ // We compare `kind`s here because we've folded the `ty` with `RegionsToStatic`
400+ // so we'll get a mismatch in types if it actually changed any regions.
390401 assert_eq ! (
391- self . infcx. root_ct_var( vid) ,
392- vid,
393- "region vid should have been resolved fully before canonicalization"
394- ) ;
395- assert_eq ! (
396- self . infcx. probe_ct_var( vid) ,
397- None ,
402+ self . infcx. opportunistic_resolve_ct_var( vid, ty) . kind( ) ,
403+ c. kind( ) ,
398404 "region vid should have been resolved fully before canonicalization"
399405 ) ;
400406 CanonicalVarKind :: Const ( self . infcx . universe_of_ct ( vid) . unwrap ( ) , ty)
0 commit comments