@@ -4,7 +4,6 @@ use crate::mir::{self, interpret};
4
4
use crate :: ty:: codec:: { RefDecodable , TyDecoder , TyEncoder } ;
5
5
use crate :: ty:: context:: TyCtxt ;
6
6
use crate :: ty:: { self , Ty } ;
7
- use rustc_data_structures:: fingerprint:: { Fingerprint , FingerprintDecoder , FingerprintEncoder } ;
8
7
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
9
8
use rustc_data_structures:: sync:: { HashMapExt , Lock , Lrc , OnceCell } ;
10
9
use rustc_data_structures:: thin_vec:: ThinVec ;
@@ -17,7 +16,7 @@ use rustc_index::vec::{Idx, IndexVec};
17
16
use rustc_query_system:: dep_graph:: DepContext ;
18
17
use rustc_query_system:: query:: QueryContext ;
19
18
use rustc_serialize:: {
20
- opaque:: { self , FileEncodeResult , FileEncoder } ,
19
+ opaque:: { self , FileEncodeResult , FileEncoder , IntEncodedWithFixedSize } ,
21
20
Decodable , Decoder , Encodable , Encoder ,
22
21
} ;
23
22
use rustc_session:: { CrateDisambiguator , Session } ;
@@ -913,12 +912,6 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for DefId {
913
912
}
914
913
}
915
914
916
- impl < ' a , ' tcx > FingerprintDecoder for CacheDecoder < ' a , ' tcx > {
917
- fn decode_fingerprint ( & mut self ) -> Result < Fingerprint , Self :: Error > {
918
- Fingerprint :: decode_opaque ( & mut self . opaque )
919
- }
920
- }
921
-
922
915
impl < ' a , ' tcx > Decodable < CacheDecoder < ' a , ' tcx > > for & ' tcx FxHashSet < LocalDefId > {
923
916
fn decode ( d : & mut CacheDecoder < ' a , ' tcx > ) -> Result < Self , String > {
924
917
RefDecodable :: decode ( d)
@@ -1011,12 +1004,6 @@ where
1011
1004
}
1012
1005
}
1013
1006
1014
- impl < ' a , ' tcx , E : OpaqueEncoder > FingerprintEncoder for CacheEncoder < ' a , ' tcx , E > {
1015
- fn encode_fingerprint ( & mut self , f : & Fingerprint ) -> Result < ( ) , E :: Error > {
1016
- self . encoder . encode_fingerprint ( f)
1017
- }
1018
- }
1019
-
1020
1007
impl < ' a , ' tcx , E > Encodable < CacheEncoder < ' a , ' tcx , E > > for SyntaxContext
1021
1008
where
1022
1009
E : ' a + OpaqueEncoder ,
@@ -1167,6 +1154,7 @@ where
1167
1154
emit_f32( f32 ) ;
1168
1155
emit_char( char ) ;
1169
1156
emit_str( & str ) ;
1157
+ emit_raw_bytes( & [ u8 ] ) ;
1170
1158
}
1171
1159
}
1172
1160
@@ -1180,42 +1168,6 @@ impl<'a, 'tcx> Encodable<CacheEncoder<'a, 'tcx, FileEncoder>> for [u8] {
1180
1168
}
1181
1169
}
1182
1170
1183
- // An integer that will always encode to 8 bytes.
1184
- struct IntEncodedWithFixedSize ( u64 ) ;
1185
-
1186
- impl IntEncodedWithFixedSize {
1187
- pub const ENCODED_SIZE : usize = 8 ;
1188
- }
1189
-
1190
- impl < E : OpaqueEncoder > Encodable < E > for IntEncodedWithFixedSize {
1191
- fn encode ( & self , e : & mut E ) -> Result < ( ) , E :: Error > {
1192
- let start_pos = e. position ( ) ;
1193
- for i in 0 ..IntEncodedWithFixedSize :: ENCODED_SIZE {
1194
- ( ( self . 0 >> ( i * 8 ) ) as u8 ) . encode ( e) ?;
1195
- }
1196
- let end_pos = e. position ( ) ;
1197
- assert_eq ! ( ( end_pos - start_pos) , IntEncodedWithFixedSize :: ENCODED_SIZE ) ;
1198
- Ok ( ( ) )
1199
- }
1200
- }
1201
-
1202
- impl < ' a > Decodable < opaque:: Decoder < ' a > > for IntEncodedWithFixedSize {
1203
- fn decode ( decoder : & mut opaque:: Decoder < ' a > ) -> Result < IntEncodedWithFixedSize , String > {
1204
- let mut value: u64 = 0 ;
1205
- let start_pos = decoder. position ( ) ;
1206
-
1207
- for i in 0 ..IntEncodedWithFixedSize :: ENCODED_SIZE {
1208
- let byte: u8 = Decodable :: decode ( decoder) ?;
1209
- value |= ( byte as u64 ) << ( i * 8 ) ;
1210
- }
1211
-
1212
- let end_pos = decoder. position ( ) ;
1213
- assert_eq ! ( ( end_pos - start_pos) , IntEncodedWithFixedSize :: ENCODED_SIZE ) ;
1214
-
1215
- Ok ( IntEncodedWithFixedSize ( value) )
1216
- }
1217
- }
1218
-
1219
1171
pub fn encode_query_results < ' a , ' tcx , CTX , Q > (
1220
1172
tcx : CTX ,
1221
1173
encoder : & mut CacheEncoder < ' a , ' tcx , FileEncoder > ,
0 commit comments