Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Dec 31, 2018
1 parent 18d6b37 commit 2738f2c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
10 changes: 7 additions & 3 deletions src/librustc/dep_graph/graph.rs
Expand Up @@ -189,7 +189,7 @@ impl DepGraph {
reads: SmallVec::new(),
read_set: Default::default(),
})),
|data, key, f, task| data.borrow_mut().complete_task(key, task, f))
|data, key, fingerprint, task| data.borrow_mut().complete_task(key, task, fingerprint))
}

/// Creates a new dep-graph input with value `input`
Expand All @@ -207,7 +207,9 @@ impl DepGraph {

self.with_task_impl(key, cx, input, true, identity_fn,
|_| OpenTask::Ignore,
|data, key, f, _| data.borrow_mut().alloc_node(key, SmallVec::new(), f))
|data, key, fingerprint, _| {
data.borrow_mut().alloc_node(key, SmallVec::new(), fingerprint)
})
}

fn with_task_impl<'gcx, C, A, R>(
Expand Down Expand Up @@ -343,7 +345,9 @@ impl DepGraph {
{
self.with_task_impl(key, cx, arg, false, task,
|key| OpenTask::EvalAlways { node: key },
|data, key, f, task| data.borrow_mut().complete_eval_always_task(key, task, f))
|data, key, fingerprint, task| {
data.borrow_mut().complete_eval_always_task(key, task, fingerprint)
})
}

#[inline]
Expand Down
16 changes: 7 additions & 9 deletions src/librustc/hir/map/collector.rs
Expand Up @@ -47,13 +47,13 @@ pub(super) struct NodeCollector<'a, 'hir> {
fn input_dep_node_and_hash<'a, I>(
dep_graph: &DepGraph,
hcx: &mut StableHashingContext<'a>,
def_node: DepNode,
dep_node: DepNode,
input: I,
) -> (DepNodeIndex, Fingerprint)
where
I: HashStable<StableHashingContext<'a>>,
{
let dep_node_index = dep_graph.input_task(def_node, &mut *hcx, &input).1;
let dep_node_index = dep_graph.input_task(dep_node, &mut *hcx, &input).1;

let hash = if dep_graph.is_fully_enabled() {
dep_graph.fingerprint_of(dep_node_index)
Expand All @@ -66,7 +66,7 @@ where
(dep_node_index, hash)
}

fn hir_dep_nodes<'a, I>(
fn alloc_hir_dep_nodes<'a, I>(
dep_graph: &DepGraph,
hcx: &mut StableHashingContext<'a>,
def_path_hash: DefPathHash,
Expand Down Expand Up @@ -121,7 +121,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
body_ids: _,
} = *krate;

hir_dep_nodes(
alloc_hir_dep_nodes(
dep_graph,
&mut hcx,
root_mod_def_path_hash,
Expand Down Expand Up @@ -172,10 +172,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
let node_hashes = self
.hir_body_nodes
.iter()
.fold(Fingerprint::ZERO, |fingerprint, &(def_path_hash, hash)| {
fingerprint.combine(
def_path_hash.0.combine(hash)
)
.fold(Fingerprint::ZERO, |combined_fingerprint, &(def_path_hash, fingerprint)| {
combined_fingerprint.combine(def_path_hash.0.combine(fingerprint))
});

let mut upstream_crates: Vec<_> = cstore.crates_untracked().iter().map(|&cnum| {
Expand Down Expand Up @@ -296,7 +294,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {

let def_path_hash = self.definitions.def_path_hash(dep_node_owner);

let (signature_dep_index, full_dep_index) = hir_dep_nodes(
let (signature_dep_index, full_dep_index) = alloc_hir_dep_nodes(
self.dep_graph,
&mut self.hcx,
def_path_hash,
Expand Down

0 comments on commit 2738f2c

Please sign in to comment.