@@ -618,8 +618,7 @@ impl<'a, 'gcx, 'tcx> SubstFolder<'a, 'gcx, 'tcx> {
618618 }
619619 } ;
620620
621- // FIXME(const_generics): shift const through binders
622- ct
621+ self . shift_vars_through_binders ( ct)
623622 }
624623
625624 /// It is sometimes necessary to adjust the De Bruijn indices during substitution. This occurs
@@ -664,15 +663,15 @@ impl<'a, 'gcx, 'tcx> SubstFolder<'a, 'gcx, 'tcx> {
664663 /// As indicated in the diagram, here the same type `&'a int` is substituted once, but in the
665664 /// first case we do not increase the De Bruijn index and in the second case we do. The reason
666665 /// is that only in the second case have we passed through a fn binder.
667- fn shift_vars_through_binders ( & self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
668- debug ! ( "shift_vars(ty ={:?}, binders_passed={:?}, has_escaping_bound_vars={:?})" ,
669- ty , self . binders_passed, ty . has_escaping_bound_vars( ) ) ;
666+ fn shift_vars_through_binders < T : TypeFoldable < ' tcx > > ( & self , val : T ) -> T {
667+ debug ! ( "shift_vars(val ={:?}, binders_passed={:?}, has_escaping_bound_vars={:?})" ,
668+ val , self . binders_passed, val . has_escaping_bound_vars( ) ) ;
670669
671- if self . binders_passed == 0 || !ty . has_escaping_bound_vars ( ) {
672- return ty ;
670+ if self . binders_passed == 0 || !val . has_escaping_bound_vars ( ) {
671+ return val ;
673672 }
674673
675- let result = ty:: fold:: shift_vars ( self . tcx ( ) , & ty , self . binders_passed ) ;
674+ let result = ty:: fold:: shift_vars ( self . tcx ( ) , & val , self . binders_passed ) ;
676675 debug ! ( "shift_vars: shifted result = {:?}" , result) ;
677676
678677 result
0 commit comments