Skip to content

Commit 0cbb8b5

Browse files
incr.comp.: Use DefPathHash-based DepNodes in the serialized DepGraph and remove obsolete DefIdDirectory.
1 parent 9da83a8 commit 0cbb8b5

File tree

6 files changed

+74
-268
lines changed

6 files changed

+74
-268
lines changed

src/librustc_incremental/persist/data.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
1313
use rustc::dep_graph::{DepNode, WorkProduct, WorkProductId};
1414
use rustc::hir::def_id::DefIndex;
15+
use rustc::hir::map::DefPathHash;
1516
use rustc::ich::Fingerprint;
1617
use rustc::middle::cstore::EncodedMetadataHash;
1718
use std::sync::Arc;
1819
use rustc_data_structures::fx::FxHashMap;
1920

20-
use super::directory::DefPathIndex;
21-
2221
/// Data for use when recompiling the **current crate**.
2322
#[derive(Debug, RustcEncodable, RustcDecodable)]
2423
pub struct SerializedDepGraph {
@@ -27,7 +26,7 @@ pub struct SerializedDepGraph {
2726
/// These are output nodes that have no incoming edges. We track
2827
/// these separately so that when we reload all edges, we don't
2928
/// lose track of these nodes.
30-
pub bootstrap_outputs: Vec<DepNode<DefPathIndex>>,
29+
pub bootstrap_outputs: Vec<DepNode<DefPathHash>>,
3130

3231
/// These are hashes of two things:
3332
/// - the HIR nodes in this crate
@@ -55,14 +54,14 @@ pub struct SerializedDepGraph {
5554
/// outgoing edges from a single source together.
5655
#[derive(Debug, RustcEncodable, RustcDecodable)]
5756
pub struct SerializedEdgeSet {
58-
pub source: DepNode<DefPathIndex>,
59-
pub targets: Vec<DepNode<DefPathIndex>>
57+
pub source: DepNode<DefPathHash>,
58+
pub targets: Vec<DepNode<DefPathHash>>
6059
}
6160

6261
#[derive(Debug, RustcEncodable, RustcDecodable)]
6362
pub struct SerializedHash {
6463
/// def-id of thing being hashed
65-
pub dep_node: DepNode<DefPathIndex>,
64+
pub dep_node: DepNode<DefPathHash>,
6665

6766
/// the hash as of previous compilation, computed by code in
6867
/// `hash` module
@@ -115,5 +114,5 @@ pub struct SerializedMetadataHashes {
115114
/// is only populated if -Z query-dep-graph is specified. It will be
116115
/// empty otherwise. Importing crates are perfectly happy with just having
117116
/// the DefIndex.
118-
pub index_map: FxHashMap<DefIndex, DefPathIndex>
117+
pub index_map: FxHashMap<DefIndex, DefPathHash>
119118
}

src/librustc_incremental/persist/directory.rs

Lines changed: 0 additions & 204 deletions
This file was deleted.

src/librustc_incremental/persist/dirty_clean.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
//! previous revision to compare things to.
4141
//!
4242
43-
use super::directory::RetracedDefIdDirectory;
4443
use super::load::DirtyNodes;
4544
use rustc::dep_graph::{DepGraphQuery, DepNode};
4645
use rustc::hir;
@@ -58,18 +57,23 @@ const LABEL: &'static str = "label";
5857
const CFG: &'static str = "cfg";
5958

6059
pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
61-
dirty_inputs: &DirtyNodes,
62-
retraced: &RetracedDefIdDirectory) {
60+
dirty_inputs: &DirtyNodes) {
6361
// can't add `#[rustc_dirty]` etc without opting in to this feature
6462
if !tcx.sess.features.borrow().rustc_attrs {
6563
return;
6664
}
6765

6866
let _ignore = tcx.dep_graph.in_ignore();
67+
let def_path_hash_to_def_id = tcx.def_path_hash_to_def_id.as_ref().unwrap();
6968
let dirty_inputs: FxHashSet<DepNode<DefId>> =
7069
dirty_inputs.keys()
71-
.filter_map(|d| retraced.map(d))
70+
.filter_map(|dep_node| {
71+
dep_node.map_def(|def_path_hash| {
72+
def_path_hash_to_def_id.get(def_path_hash).cloned()
73+
})
74+
})
7275
.collect();
76+
7377
let query = tcx.dep_graph.query();
7478
debug!("query-nodes: {:?}", query.nodes());
7579
let krate = tcx.hir.krate();

0 commit comments

Comments
 (0)