@@ -283,8 +283,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
283283 bug ! ( "encountered a fresh type during canonicalization" )
284284 }
285285
286- ty:: Infer ( ty :: BoundTy ( _ ) ) => {
287- bug ! ( "encountered a canonical type during canonicalization" )
286+ ty:: Bound ( _ ) => {
287+ bug ! ( "encountered a bound type during canonicalization" )
288288 }
289289
290290 ty:: Closure ( ..)
@@ -393,7 +393,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
393393 /// or returns an existing variable if `kind` has already been
394394 /// seen. `kind` is expected to be an unbound variable (or
395395 /// potentially a free region).
396- fn canonical_var ( & mut self , info : CanonicalVarInfo , kind : Kind < ' tcx > ) -> BoundTy {
396+ fn canonical_var ( & mut self , info : CanonicalVarInfo , kind : Kind < ' tcx > ) -> BoundTyIndex {
397397 let Canonicalizer {
398398 variables,
399399 query_state,
@@ -444,19 +444,15 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
444444 } )
445445 } ;
446446
447- BoundTy {
448- level : ty:: INNERMOST ,
449- var,
450- }
447+ var
451448 }
452449
453450 fn canonical_var_for_region ( & mut self , r : ty:: Region < ' tcx > ) -> ty:: Region < ' tcx > {
454451 let info = CanonicalVarInfo {
455452 kind : CanonicalVarKind :: Region ,
456453 } ;
457- let b = self . canonical_var ( info, r. into ( ) ) ;
458- debug_assert_eq ! ( ty:: INNERMOST , b. level) ;
459- self . tcx ( ) . mk_region ( ty:: ReCanonical ( b. var ) )
454+ let var = self . canonical_var ( info, r. into ( ) ) ;
455+ self . tcx ( ) . mk_region ( ty:: ReCanonical ( var) )
460456 }
461457
462458 /// Given a type variable `ty_var` of the given kind, first check
@@ -472,9 +468,8 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
472468 let info = CanonicalVarInfo {
473469 kind : CanonicalVarKind :: Ty ( ty_kind) ,
474470 } ;
475- let b = self . canonical_var ( info, ty_var. into ( ) ) ;
476- debug_assert_eq ! ( ty:: INNERMOST , b. level) ;
477- self . tcx ( ) . mk_infer ( ty:: InferTy :: BoundTy ( b) )
471+ let var = self . canonical_var ( info, ty_var. into ( ) ) ;
472+ self . tcx ( ) . mk_ty ( ty:: Bound ( BoundTy :: new ( ty:: INNERMOST , var) ) )
478473 }
479474 }
480475}
0 commit comments