@@ -337,8 +337,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
337
337
bug ! ( "encountered a fresh type during canonicalization" )
338
338
}
339
339
340
- ty:: Infer ( ty :: BoundTy ( _ ) ) => {
341
- bug ! ( "encountered a canonical type during canonicalization" )
340
+ ty:: Bound ( _ ) => {
341
+ bug ! ( "encountered a bound type during canonicalization" )
342
342
}
343
343
344
344
ty:: Closure ( ..)
@@ -455,7 +455,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
455
455
/// or returns an existing variable if `kind` has already been
456
456
/// seen. `kind` is expected to be an unbound variable (or
457
457
/// potentially a free region).
458
- fn canonical_var ( & mut self , info : CanonicalVarInfo , kind : Kind < ' tcx > ) -> BoundTy {
458
+ fn canonical_var ( & mut self , info : CanonicalVarInfo , kind : Kind < ' tcx > ) -> BoundTyIndex {
459
459
let Canonicalizer {
460
460
variables,
461
461
query_state,
@@ -506,10 +506,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
506
506
} )
507
507
} ;
508
508
509
- BoundTy {
510
- level : ty:: INNERMOST ,
511
- var,
512
- }
509
+ var
513
510
}
514
511
515
512
/// Shorthand helper that creates a canonical region variable for
@@ -552,9 +549,8 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
552
549
info : CanonicalVarInfo ,
553
550
r : ty:: Region < ' tcx > ,
554
551
) -> ty:: Region < ' tcx > {
555
- let b = self . canonical_var ( info, r. into ( ) ) ;
556
- debug_assert_eq ! ( ty:: INNERMOST , b. level) ;
557
- self . tcx ( ) . mk_region ( ty:: ReCanonical ( b. var ) )
552
+ let var = self . canonical_var ( info, r. into ( ) ) ;
553
+ self . tcx ( ) . mk_region ( ty:: ReCanonical ( var) )
558
554
}
559
555
560
556
/// Given a type variable `ty_var` of the given kind, first check
@@ -570,9 +566,8 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
570
566
let info = CanonicalVarInfo {
571
567
kind : CanonicalVarKind :: Ty ( ty_kind) ,
572
568
} ;
573
- let b = self . canonical_var ( info, ty_var. into ( ) ) ;
574
- debug_assert_eq ! ( ty:: INNERMOST , b. level) ;
575
- self . tcx ( ) . mk_infer ( ty:: InferTy :: BoundTy ( b) )
569
+ let var = self . canonical_var ( info, ty_var. into ( ) ) ;
570
+ self . tcx ( ) . mk_ty ( ty:: Bound ( BoundTy :: new ( ty:: INNERMOST , var) ) )
576
571
}
577
572
}
578
573
}
0 commit comments