@@ -97,9 +97,6 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
9797 fn has_infer_types_or_consts ( & self ) -> bool {
9898 self . has_type_flags ( TypeFlags :: HAS_TY_INFER | TypeFlags :: HAS_CT_INFER )
9999 }
100- fn has_infer_consts ( & self ) -> bool {
101- self . has_type_flags ( TypeFlags :: HAS_CT_INFER )
102- }
103100 fn needs_infer ( & self ) -> bool {
104101 self . has_type_flags ( TypeFlags :: NEEDS_INFER )
105102 }
@@ -113,9 +110,6 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
113110 fn needs_subst ( & self ) -> bool {
114111 self . has_type_flags ( TypeFlags :: NEEDS_SUBST )
115112 }
116- fn has_re_placeholders ( & self ) -> bool {
117- self . has_type_flags ( TypeFlags :: HAS_RE_PLACEHOLDER )
118- }
119113 /// "Free" regions in this context means that it has any region
120114 /// that is not (a) erased or (b) late-bound.
121115 fn has_free_regions ( & self ) -> bool {
@@ -719,21 +713,15 @@ impl<'tcx> TyCtxt<'tcx> {
719713// vars. See comment on `shift_vars_through_binders` method in
720714// `subst.rs` for more details.
721715
722- enum Direction {
723- In ,
724- Out ,
725- }
726-
727716struct Shifter < ' tcx > {
728717 tcx : TyCtxt < ' tcx > ,
729718 current_index : ty:: DebruijnIndex ,
730719 amount : u32 ,
731- direction : Direction ,
732720}
733721
734722impl Shifter < ' tcx > {
735- pub fn new ( tcx : TyCtxt < ' tcx > , amount : u32 , direction : Direction ) -> Self {
736- Shifter { tcx, current_index : ty:: INNERMOST , amount, direction }
723+ pub fn new ( tcx : TyCtxt < ' tcx > , amount : u32 ) -> Self {
724+ Shifter { tcx, current_index : ty:: INNERMOST , amount }
737725 }
738726}
739727
@@ -755,13 +743,7 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
755743 if self . amount == 0 || debruijn < self . current_index {
756744 r
757745 } else {
758- let debruijn = match self . direction {
759- Direction :: In => debruijn. shifted_in ( self . amount ) ,
760- Direction :: Out => {
761- assert ! ( debruijn. as_u32( ) >= self . amount) ;
762- debruijn. shifted_out ( self . amount )
763- }
764- } ;
746+ let debruijn = debruijn. shifted_in ( self . amount ) ;
765747 let shifted = ty:: ReLateBound ( debruijn, br) ;
766748 self . tcx . mk_region ( shifted)
767749 }
@@ -776,13 +758,7 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
776758 if self . amount == 0 || debruijn < self . current_index {
777759 ty
778760 } else {
779- let debruijn = match self . direction {
780- Direction :: In => debruijn. shifted_in ( self . amount ) ,
781- Direction :: Out => {
782- assert ! ( debruijn. as_u32( ) >= self . amount) ;
783- debruijn. shifted_out ( self . amount )
784- }
785- } ;
761+ let debruijn = debruijn. shifted_in ( self . amount ) ;
786762 self . tcx . mk_ty ( ty:: Bound ( debruijn, bound_ty) )
787763 }
788764 }
@@ -796,13 +772,7 @@ impl TypeFolder<'tcx> for Shifter<'tcx> {
796772 if self . amount == 0 || debruijn < self . current_index {
797773 ct
798774 } else {
799- let debruijn = match self . direction {
800- Direction :: In => debruijn. shifted_in ( self . amount ) ,
801- Direction :: Out => {
802- assert ! ( debruijn. as_u32( ) >= self . amount) ;
803- debruijn. shifted_out ( self . amount )
804- }
805- } ;
775+ let debruijn = debruijn. shifted_in ( self . amount ) ;
806776 self . tcx . mk_const ( ty:: Const { val : ty:: ConstKind :: Bound ( debruijn, bound_ct) , ty } )
807777 }
808778 } else {
@@ -830,16 +800,7 @@ where
830800{
831801 debug ! ( "shift_vars(value={:?}, amount={})" , value, amount) ;
832802
833- value. fold_with ( & mut Shifter :: new ( tcx, amount, Direction :: In ) )
834- }
835-
836- pub fn shift_out_vars < ' tcx , T > ( tcx : TyCtxt < ' tcx > , value : & T , amount : u32 ) -> T
837- where
838- T : TypeFoldable < ' tcx > ,
839- {
840- debug ! ( "shift_out_vars(value={:?}, amount={})" , value, amount) ;
841-
842- value. fold_with ( & mut Shifter :: new ( tcx, amount, Direction :: Out ) )
803+ value. fold_with ( & mut Shifter :: new ( tcx, amount) )
843804}
844805
845806/// An "escaping var" is a bound var whose binder is not part of `t`. A bound var can be a
0 commit comments