Skip to content
Browse files

Only hash dep node indices of deps of anon tasks

  • Loading branch information...
Zoxc committed Apr 16, 2019
1 parent 46d0ca0 commit 97d3ad066d08d98ba574f2da8d379dce07fc286f
Showing with 9 additions and 12 deletions.
  1. +9 −12 src/librustc/dep_graph/
@@ -1021,25 +1021,22 @@ impl CurrentDepGraph {
fn complete_anon_task(&mut self, kind: DepKind, task_deps: TaskDeps) -> DepNodeIndex {

let mut fingerprint = self.anon_id_seed;
let mut hasher = StableHasher::new();

for &read in task_deps.reads.iter() {
let read_dep_node =[read].node;
// The dep node indices are hashed here instead of hashing the dep nodes of the
// dependencies. These indices may refer to different nodes per session, but this isn't
// a problem here because we that ensure the final dep node hash is per session only by
// combining it with the per session random number `anon_id_seed`. This hash only need
// to map the dependencies to a single value on a per session basis.
task_deps.reads.hash(&mut hasher);

::std::mem::discriminant(&read_dep_node.kind).hash(&mut hasher);
let target_dep_node = DepNode {

// Fingerprint::combine() is faster than sending Fingerprint
// through the StableHasher (at least as long as StableHasher
// is so slow).
fingerprint = fingerprint.combine(read_dep_node.hash);

fingerprint = fingerprint.combine(hasher.finish());

let target_dep_node = DepNode {
hash: fingerprint,
hash: self.anon_id_seed.combine(hasher.finish()),

self.intern_node(target_dep_node, task_deps.reads, Fingerprint::ZERO).0

0 comments on commit 97d3ad0

Please sign in to comment.
You can’t perform that action at this time.