@@ -14,18 +14,50 @@ use rustc::dep_graph::DepNode;
1414
1515use super :: directory:: DefPathIndex ;
1616
17+ /// Data for use when recompiling the **current crate**.
1718#[ derive( Debug , RustcEncodable , RustcDecodable ) ]
1819pub struct SerializedDepGraph {
1920 pub nodes : Vec < DepNode < DefPathIndex > > ,
2021 pub edges : Vec < SerializedEdge > ,
22+
23+ /// These are hashes of two things:
24+ /// - the HIR nodes in this crate
25+ /// - the metadata nodes from dependent crates we use
26+ ///
27+ /// In each case, we store a hash summarizing the contents of
28+ /// those items as they were at the time we did this compilation.
29+ /// In the case of HIR nodes, this hash is derived by walking the
30+ /// HIR itself. In the case of metadata nodes, the hash is loaded
31+ /// from saved state.
32+ ///
33+ /// When we do the next compile, we will load these back up and
34+ /// compare them against the hashes we see at that time, which
35+ /// will tell us what has changed, either in this crate or in some
36+ /// crate that we depend on.
37+ pub hashes : Vec < SerializedHash > ,
38+ }
39+
40+ /// Data for use when downstream crates get recompiled.
41+ #[ derive( Debug , RustcEncodable , RustcDecodable ) ]
42+ pub struct SerializedMetadataHashes {
43+ /// For each def-id defined in this crate that appears in the
44+ /// metadata, we hash all the inputs that were used when producing
45+ /// the metadata. We save this after compilation is done. Then,
46+ /// when some downstream crate is being recompiled, it can compare
47+ /// the hashes we saved against the hashes that it saw from
48+ /// before; this will tell it which of the items in this crate
49+ /// changed, which in turn implies what items in the downstream
50+ /// crate need to be recompiled.
2151 pub hashes : Vec < SerializedHash > ,
2252}
2353
2454pub type SerializedEdge = ( DepNode < DefPathIndex > , DepNode < DefPathIndex > ) ;
2555
2656#[ derive( Debug , RustcEncodable , RustcDecodable ) ]
2757pub struct SerializedHash {
28- pub index : DefPathIndex ,
58+ /// node being hashed; either a Hir or MetaData variant, in
59+ /// practice
60+ pub node : DepNode < DefPathIndex > ,
2961
3062 /// the hash itself, computed by `calculate_item_hash`
3163 pub hash : u64 ,
0 commit comments