1
- use crate :: dep_graph:: { DepNodeIndex , SerializedDepNodeIndex } ;
1
+ use crate :: dep_graph:: DepNodeIndex ;
2
2
use crate :: mir:: interpret:: { AllocDecodingSession , AllocDecodingState } ;
3
3
use crate :: mir:: { self , interpret} ;
4
4
use crate :: ty:: codec:: { self as ty_codec, TyDecoder , TyEncoder } ;
@@ -12,7 +12,7 @@ use rustc_data_structures::thin_vec::ThinVec;
12
12
use rustc_errors:: Diagnostic ;
13
13
use rustc_hir:: def_id:: { CrateNum , DefId , DefIndex , LocalDefId , LOCAL_CRATE } ;
14
14
use rustc_hir:: definitions:: DefPathHash ;
15
- use rustc_index:: vec:: { Idx , IndexVec } ;
15
+ use rustc_index:: vec:: IndexVec ;
16
16
use rustc_serialize:: {
17
17
opaque, Decodable , Decoder , Encodable , Encoder , SpecializedDecoder , SpecializedEncoder ,
18
18
UseSpecializedDecodable , UseSpecializedEncodable ,
@@ -60,11 +60,11 @@ pub struct OnDiskCache<'sess> {
60
60
61
61
// A map from dep-node to the position of the cached query result in
62
62
// `serialized_data`.
63
- query_result_index : FxHashMap < SerializedDepNodeIndex , AbsoluteBytePos > ,
63
+ query_result_index : FxHashMap < DepNodeIndex , AbsoluteBytePos > ,
64
64
65
65
// A map from dep-node to the position of any associated diagnostics in
66
66
// `serialized_data`.
67
- prev_diagnostics_index : FxHashMap < SerializedDepNodeIndex , AbsoluteBytePos > ,
67
+ prev_diagnostics_index : FxHashMap < DepNodeIndex , AbsoluteBytePos > ,
68
68
69
69
alloc_decoding_state : AllocDecodingState ,
70
70
}
@@ -80,8 +80,8 @@ struct Footer {
80
80
interpret_alloc_index : Vec < u32 > ,
81
81
}
82
82
83
- type EncodedQueryResultIndex = Vec < ( SerializedDepNodeIndex , AbsoluteBytePos ) > ;
84
- type EncodedDiagnosticsIndex = Vec < ( SerializedDepNodeIndex , AbsoluteBytePos ) > ;
83
+ type EncodedQueryResultIndex = Vec < ( DepNodeIndex , AbsoluteBytePos ) > ;
84
+ type EncodedDiagnosticsIndex = Vec < ( DepNodeIndex , AbsoluteBytePos ) > ;
85
85
type EncodedDiagnostics = Vec < Diagnostic > ;
86
86
87
87
#[ derive( Copy , Clone , PartialEq , Eq , Hash , Debug , RustcEncodable , RustcDecodable ) ]
@@ -224,11 +224,10 @@ impl<'sess> OnDiskCache<'sess> {
224
224
. current_diagnostics
225
225
. borrow ( )
226
226
. iter ( )
227
- . map ( |( dep_node_index, diagnostics) | {
227
+ . map ( |( & dep_node_index, diagnostics) | {
228
228
let pos = AbsoluteBytePos :: new ( encoder. position ( ) ) ;
229
229
// Let's make sure we get the expected type here.
230
230
let diagnostics: & EncodedDiagnostics = diagnostics;
231
- let dep_node_index = SerializedDepNodeIndex :: new ( dep_node_index. index ( ) ) ;
232
231
encoder. encode_tagged ( dep_node_index, diagnostics) ?;
233
232
234
233
Ok ( ( dep_node_index, pos) )
@@ -304,7 +303,7 @@ impl<'sess> OnDiskCache<'sess> {
304
303
pub fn load_diagnostics (
305
304
& self ,
306
305
tcx : TyCtxt < ' _ > ,
307
- dep_node_index : SerializedDepNodeIndex ,
306
+ dep_node_index : DepNodeIndex ,
308
307
) -> Vec < Diagnostic > {
309
308
let diagnostics: Option < EncodedDiagnostics > =
310
309
self . load_indexed ( tcx, dep_node_index, & self . prev_diagnostics_index , "diagnostics" ) ;
@@ -328,11 +327,11 @@ impl<'sess> OnDiskCache<'sess> {
328
327
}
329
328
330
329
/// 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`.
332
331
pub fn try_load_query_result < T > (
333
332
& self ,
334
333
tcx : TyCtxt < ' _ > ,
335
- dep_node_index : SerializedDepNodeIndex ,
334
+ dep_node_index : DepNodeIndex ,
336
335
) -> Option < T >
337
336
where
338
337
T : Decodable ,
@@ -361,8 +360,8 @@ impl<'sess> OnDiskCache<'sess> {
361
360
fn load_indexed < ' tcx , T > (
362
361
& self ,
363
362
tcx : TyCtxt < ' tcx > ,
364
- dep_node_index : SerializedDepNodeIndex ,
365
- index : & FxHashMap < SerializedDepNodeIndex , AbsoluteBytePos > ,
363
+ dep_node_index : DepNodeIndex ,
364
+ index : & FxHashMap < DepNodeIndex , AbsoluteBytePos > ,
366
365
debug_tag : & ' static str ,
367
366
) -> Option < T >
368
367
where
@@ -1009,12 +1008,10 @@ where
1009
1008
state. iter_results ( |results| {
1010
1009
for ( key, value, dep_node) in results {
1011
1010
if Q :: cache_on_disk ( tcx, key. clone ( ) , Some ( & value) ) {
1012
- let dep_node = SerializedDepNodeIndex :: new ( dep_node. index ( ) ) ;
1013
-
1014
1011
// Record position of the cache entry.
1015
1012
query_result_index. push ( ( dep_node, AbsoluteBytePos :: new ( encoder. position ( ) ) ) ) ;
1016
1013
1017
- // Encode the type check tables with the `SerializedDepNodeIndex `
1014
+ // Encode the type check tables with the `DepNodeIndex `
1018
1015
// as tag.
1019
1016
encoder. encode_tagged ( dep_node, & value) ?;
1020
1017
}
0 commit comments