@@ -337,8 +337,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
337337 bug ! ( "encountered a fresh type during canonicalization" )
338338 }
339339
340- ty:: Infer ( ty :: BoundTy ( _ ) ) => {
341- bug ! ( "encountered a canonical type during canonicalization" )
340+ ty:: Bound ( _ ) => {
341+ bug ! ( "encountered a bound type during canonicalization" )
342342 }
343343
344344 ty:: Closure ( ..)
@@ -455,7 +455,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
455455 /// or returns an existing variable if `kind` has already been
456456 /// seen. `kind` is expected to be an unbound variable (or
457457 /// 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 {
459459 let Canonicalizer {
460460 variables,
461461 query_state,
@@ -506,10 +506,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
506506 } )
507507 } ;
508508
509- BoundTy {
510- level : ty:: INNERMOST ,
511- var,
512- }
509+ var
513510 }
514511
515512 /// Shorthand helper that creates a canonical region variable for
@@ -552,9 +549,8 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
552549 info : CanonicalVarInfo ,
553550 r : ty:: Region < ' tcx > ,
554551 ) -> 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) )
558554 }
559555
560556 /// Given a type variable `ty_var` of the given kind, first check
@@ -570,9 +566,8 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
570566 let info = CanonicalVarInfo {
571567 kind : CanonicalVarKind :: Ty ( ty_kind) ,
572568 } ;
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) ) )
576571 }
577572 }
578573}
0 commit comments