1- use crate :: dep_graph:: { DepNodeIndex , SerializedDepNodeIndex } ;
1+ use crate :: dep_graph:: DepNodeIndex ;
22use crate :: mir:: interpret:: { AllocDecodingSession , AllocDecodingState } ;
33use crate :: mir:: { self , interpret} ;
44use crate :: ty:: codec:: { self as ty_codec, TyDecoder , TyEncoder } ;
@@ -12,7 +12,7 @@ use rustc_data_structures::thin_vec::ThinVec;
1212use rustc_errors:: Diagnostic ;
1313use rustc_hir:: def_id:: { CrateNum , DefId , DefIndex , LocalDefId , LOCAL_CRATE } ;
1414use rustc_hir:: definitions:: DefPathHash ;
15- use rustc_index:: vec:: { Idx , IndexVec } ;
15+ use rustc_index:: vec:: IndexVec ;
1616use rustc_serialize:: {
1717 opaque, Decodable , Decoder , Encodable , Encoder , SpecializedDecoder , SpecializedEncoder ,
1818 UseSpecializedDecodable , UseSpecializedEncodable ,
@@ -60,11 +60,11 @@ pub struct OnDiskCache<'sess> {
6060
6161 // A map from dep-node to the position of the cached query result in
6262 // `serialized_data`.
63- query_result_index : FxHashMap < SerializedDepNodeIndex , AbsoluteBytePos > ,
63+ query_result_index : FxHashMap < DepNodeIndex , AbsoluteBytePos > ,
6464
6565 // A map from dep-node to the position of any associated diagnostics in
6666 // `serialized_data`.
67- prev_diagnostics_index : FxHashMap < SerializedDepNodeIndex , AbsoluteBytePos > ,
67+ prev_diagnostics_index : FxHashMap < DepNodeIndex , AbsoluteBytePos > ,
6868
6969 alloc_decoding_state : AllocDecodingState ,
7070}
@@ -80,8 +80,8 @@ struct Footer {
8080 interpret_alloc_index : Vec < u32 > ,
8181}
8282
83- type EncodedQueryResultIndex = Vec < ( SerializedDepNodeIndex , AbsoluteBytePos ) > ;
84- type EncodedDiagnosticsIndex = Vec < ( SerializedDepNodeIndex , AbsoluteBytePos ) > ;
83+ type EncodedQueryResultIndex = Vec < ( DepNodeIndex , AbsoluteBytePos ) > ;
84+ type EncodedDiagnosticsIndex = Vec < ( DepNodeIndex , AbsoluteBytePos ) > ;
8585type EncodedDiagnostics = Vec < Diagnostic > ;
8686
8787#[ derive( Copy , Clone , PartialEq , Eq , Hash , Debug , RustcEncodable , RustcDecodable ) ]
@@ -224,11 +224,10 @@ impl<'sess> OnDiskCache<'sess> {
224224 . current_diagnostics
225225 . borrow ( )
226226 . iter ( )
227- . map ( |( dep_node_index, diagnostics) | {
227+ . map ( |( & dep_node_index, diagnostics) | {
228228 let pos = AbsoluteBytePos :: new ( encoder. position ( ) ) ;
229229 // Let's make sure we get the expected type here.
230230 let diagnostics: & EncodedDiagnostics = diagnostics;
231- let dep_node_index = SerializedDepNodeIndex :: new ( dep_node_index. index ( ) ) ;
232231 encoder. encode_tagged ( dep_node_index, diagnostics) ?;
233232
234233 Ok ( ( dep_node_index, pos) )
@@ -304,7 +303,7 @@ impl<'sess> OnDiskCache<'sess> {
304303 pub fn load_diagnostics (
305304 & self ,
306305 tcx : TyCtxt < ' _ > ,
307- dep_node_index : SerializedDepNodeIndex ,
306+ dep_node_index : DepNodeIndex ,
308307 ) -> Vec < Diagnostic > {
309308 let diagnostics: Option < EncodedDiagnostics > =
310309 self . load_indexed ( tcx, dep_node_index, & self . prev_diagnostics_index , "diagnostics" ) ;
@@ -328,11 +327,11 @@ impl<'sess> OnDiskCache<'sess> {
328327 }
329328
330329 /// Returns the cached query result if there is something in the cache for
331- /// the given `SerializedDepNodeIndex `; otherwise returns `None`.
330+ /// the given `DepNodeIndex `; otherwise returns `None`.
332331 pub fn try_load_query_result < T > (
333332 & self ,
334333 tcx : TyCtxt < ' _ > ,
335- dep_node_index : SerializedDepNodeIndex ,
334+ dep_node_index : DepNodeIndex ,
336335 ) -> Option < T >
337336 where
338337 T : Decodable ,
@@ -361,8 +360,8 @@ impl<'sess> OnDiskCache<'sess> {
361360 fn load_indexed < ' tcx , T > (
362361 & self ,
363362 tcx : TyCtxt < ' tcx > ,
364- dep_node_index : SerializedDepNodeIndex ,
365- index : & FxHashMap < SerializedDepNodeIndex , AbsoluteBytePos > ,
363+ dep_node_index : DepNodeIndex ,
364+ index : & FxHashMap < DepNodeIndex , AbsoluteBytePos > ,
366365 debug_tag : & ' static str ,
367366 ) -> Option < T >
368367 where
@@ -1009,12 +1008,10 @@ where
10091008 state. iter_results ( |results| {
10101009 for ( key, value, dep_node) in results {
10111010 if Q :: cache_on_disk ( tcx, key. clone ( ) , Some ( & value) ) {
1012- let dep_node = SerializedDepNodeIndex :: new ( dep_node. index ( ) ) ;
1013-
10141011 // Record position of the cache entry.
10151012 query_result_index. push ( ( dep_node, AbsoluteBytePos :: new ( encoder. position ( ) ) ) ) ;
10161013
1017- // Encode the type check tables with the `SerializedDepNodeIndex `
1014+ // Encode the type check tables with the `DepNodeIndex `
10181015 // as tag.
10191016 encoder. encode_tagged ( dep_node, & value) ?;
10201017 }
0 commit comments