@@ -4,7 +4,6 @@ use crate::mir::{self, interpret};
44use crate :: ty:: codec:: { RefDecodable , TyDecoder , TyEncoder } ;
55use crate :: ty:: context:: TyCtxt ;
66use crate :: ty:: { self , Ty } ;
7- use rustc_data_structures:: fingerprint:: { Fingerprint , FingerprintDecoder , FingerprintEncoder } ;
87use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
98use rustc_data_structures:: sync:: { HashMapExt , Lock , Lrc , OnceCell } ;
109use rustc_data_structures:: thin_vec:: ThinVec ;
@@ -17,7 +16,7 @@ use rustc_index::vec::{Idx, IndexVec};
1716use rustc_query_system:: dep_graph:: DepContext ;
1817use rustc_query_system:: query:: QueryContext ;
1918use rustc_serialize:: {
20- opaque:: { self , FileEncodeResult , FileEncoder } ,
19+ opaque:: { self , FileEncodeResult , FileEncoder , IntEncodedWithFixedSize } ,
2120 Decodable , Decoder , Encodable , Encoder ,
2221} ;
2322use rustc_session:: { CrateDisambiguator , Session } ;
@@ -913,12 +912,6 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for DefId {
913912 }
914913}
915914
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-
922915impl < ' a , ' tcx > Decodable < CacheDecoder < ' a , ' tcx > > for & ' tcx FxHashSet < LocalDefId > {
923916 fn decode ( d : & mut CacheDecoder < ' a , ' tcx > ) -> Result < Self , String > {
924917 RefDecodable :: decode ( d)
@@ -1011,12 +1004,6 @@ where
10111004 }
10121005}
10131006
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-
10201007impl < ' a , ' tcx , E > Encodable < CacheEncoder < ' a , ' tcx , E > > for SyntaxContext
10211008where
10221009 E : ' a + OpaqueEncoder ,
@@ -1167,6 +1154,7 @@ where
11671154 emit_f32( f32 ) ;
11681155 emit_char( char ) ;
11691156 emit_str( & str ) ;
1157+ emit_raw_bytes( & [ u8 ] ) ;
11701158 }
11711159}
11721160
@@ -1180,42 +1168,6 @@ impl<'a, 'tcx> Encodable<CacheEncoder<'a, 'tcx, FileEncoder>> for [u8] {
11801168 }
11811169}
11821170
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-
12191171pub fn encode_query_results < ' a , ' tcx , CTX , Q > (
12201172 tcx : CTX ,
12211173 encoder : & mut CacheEncoder < ' a , ' tcx , FileEncoder > ,
0 commit comments