@@ -268,7 +268,7 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I>
268
268
ty:: ReVar ( vid) => {
269
269
assert_eq ! (
270
270
self . infcx. opportunistic_resolve_lt_var( vid) ,
271
- None ,
271
+ r ,
272
272
"region vid should have been resolved fully before canonicalization"
273
273
) ;
274
274
match self . canonicalize_mode {
@@ -302,13 +302,8 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I>
302
302
ty:: Infer ( i) => match i {
303
303
ty:: TyVar ( vid) => {
304
304
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,
312
307
"ty vid should have been resolved fully before canonicalization"
313
308
) ;
314
309
@@ -318,10 +313,24 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I>
318
313
. unwrap_or_else ( || panic ! ( "ty var should have been resolved: {t:?}" ) ) ,
319
314
) )
320
315
}
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
+ }
323
332
ty:: FreshTy ( _) | ty:: FreshIntTy ( _) | ty:: FreshFloatTy ( _) => {
324
- todo ! ( )
333
+ panic ! ( "fresh vars not expected in canonicalization" )
325
334
}
326
335
} ,
327
336
ty:: Placeholder ( placeholder) => match self . canonicalize_mode {
@@ -387,14 +396,11 @@ impl<Infcx: InferCtxtLike<Interner = I>, I: Interner> TypeFolder<I>
387
396
let kind = match c. kind ( ) {
388
397
ty:: ConstKind :: Infer ( i) => match i {
389
398
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.
390
401
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( ) ,
398
404
"region vid should have been resolved fully before canonicalization"
399
405
) ;
400
406
CanonicalVarKind :: Const ( self . infcx . universe_of_ct ( vid) . unwrap ( ) , ty)
0 commit comments