@@ -115,18 +115,11 @@ impl<'tcx, E: TyEncoder<I = TyCtxt<'tcx>>> Encodable<E> for Ty<'tcx> {
115
115
}
116
116
}
117
117
118
- impl < ' tcx , E : TyEncoder < I = TyCtxt < ' tcx > > > Encodable < E >
119
- for ty:: Binder < ' tcx , ty:: PredicateKind < ' tcx > >
120
- {
121
- fn encode ( & self , e : & mut E ) {
122
- self . bound_vars ( ) . encode ( e) ;
123
- encode_with_shorthand ( e, & self . skip_binder ( ) , TyEncoder :: predicate_shorthands) ;
124
- }
125
- }
126
-
127
118
impl < ' tcx , E : TyEncoder < I = TyCtxt < ' tcx > > > Encodable < E > for ty:: Predicate < ' tcx > {
128
119
fn encode ( & self , e : & mut E ) {
129
- self . kind ( ) . encode ( e) ;
120
+ let kind = self . kind ( ) ;
121
+ kind. bound_vars ( ) . encode ( e) ;
122
+ encode_with_shorthand ( e, & kind. skip_binder ( ) , TyEncoder :: predicate_shorthands) ;
130
123
}
131
124
}
132
125
@@ -233,13 +226,11 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D> for Ty<'tcx> {
233
226
}
234
227
}
235
228
236
- impl < ' tcx , D : TyDecoder < I = TyCtxt < ' tcx > > > Decodable < D >
237
- for ty:: Binder < ' tcx , ty:: PredicateKind < ' tcx > >
238
- {
239
- fn decode ( decoder : & mut D ) -> ty:: Binder < ' tcx , ty:: PredicateKind < ' tcx > > {
229
+ impl < ' tcx , D : TyDecoder < I = TyCtxt < ' tcx > > > Decodable < D > for ty:: Predicate < ' tcx > {
230
+ fn decode ( decoder : & mut D ) -> ty:: Predicate < ' tcx > {
240
231
let bound_vars = Decodable :: decode ( decoder) ;
241
232
// Handle shorthands first, if we have a usize > 0x80.
242
- ty:: Binder :: bind_with_vars (
233
+ let predicate_kind = ty:: Binder :: bind_with_vars (
243
234
if decoder. positioned_at_shorthand ( ) {
244
235
let pos = decoder. read_usize ( ) ;
245
236
assert ! ( pos >= SHORTHAND_OFFSET ) ;
@@ -250,13 +241,7 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D>
250
241
<ty:: PredicateKind < ' tcx > as Decodable < D > >:: decode ( decoder)
251
242
} ,
252
243
bound_vars,
253
- )
254
- }
255
- }
256
-
257
- impl < ' tcx , D : TyDecoder < I = TyCtxt < ' tcx > > > Decodable < D > for ty:: Predicate < ' tcx > {
258
- fn decode ( decoder : & mut D ) -> ty:: Predicate < ' tcx > {
259
- let predicate_kind = Decodable :: decode ( decoder) ;
244
+ ) ;
260
245
decoder. interner ( ) . mk_predicate ( predicate_kind)
261
246
}
262
247
}
@@ -599,32 +584,3 @@ macro_rules! implement_ty_decoder {
599
584
}
600
585
}
601
586
}
602
-
603
- macro_rules! impl_binder_encode_decode {
604
- ( $( $t: ty) ,+ $( , ) ?) => {
605
- $(
606
- impl <' tcx, E : TyEncoder <I = TyCtxt <' tcx>>> Encodable <E > for ty:: Binder <' tcx, $t> {
607
- fn encode( & self , e: & mut E ) {
608
- self . bound_vars( ) . encode( e) ;
609
- self . as_ref( ) . skip_binder( ) . encode( e) ;
610
- }
611
- }
612
- impl <' tcx, D : TyDecoder <I = TyCtxt <' tcx>>> Decodable <D > for ty:: Binder <' tcx, $t> {
613
- fn decode( decoder: & mut D ) -> Self {
614
- let bound_vars = Decodable :: decode( decoder) ;
615
- ty:: Binder :: bind_with_vars( Decodable :: decode( decoder) , bound_vars)
616
- }
617
- }
618
- ) *
619
- }
620
- }
621
-
622
- impl_binder_encode_decode ! {
623
- & ' tcx ty:: List <Ty <' tcx>>,
624
- ty:: FnSig <' tcx>,
625
- ty:: Predicate <' tcx>,
626
- ty:: TraitPredicate <' tcx>,
627
- ty:: ExistentialPredicate <' tcx>,
628
- ty:: TraitRef <' tcx>,
629
- ty:: ExistentialTraitRef <' tcx>,
630
- }
0 commit comments