Skip to content

incr.comp.: Incorporate the stable commandline arg hash and SVHs of upstream crates into the SVH. #46427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/librustc/hir/map/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::*;

use dep_graph::{DepGraph, DepKind, DepNodeIndex};
use hir::intravisit::{Visitor, NestedVisitorMap};
use middle::cstore::CrateStore;
use session::CrateDisambiguator;
use std::iter::repeat;
use syntax::ast::{NodeId, CRATE_NODE_ID};
Expand Down Expand Up @@ -119,7 +120,9 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
}

pub(super) fn finalize_and_compute_crate_hash(self,
crate_disambiguator: CrateDisambiguator)
crate_disambiguator: CrateDisambiguator,
cstore: &CrateStore,
commandline_args_hash: u64)
-> Vec<MapEntry<'hir>> {
let mut node_hashes: Vec<_> = self
.hir_body_nodes
Expand All @@ -132,9 +135,23 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {

node_hashes.sort_unstable_by(|&(ref d1, _), &(ref d2, _)| d1.cmp(d2));

let mut upstream_crates: Vec<_> = cstore.crates_untracked().iter().map(|&cnum| {
let name = cstore.crate_name_untracked(cnum).as_str();
let disambiguator = cstore.crate_disambiguator_untracked(cnum)
.to_fingerprint();
let hash = cstore.crate_hash_untracked(cnum);
(name, disambiguator, hash)
}).collect();

upstream_crates.sort_unstable_by(|&(name1, dis1, _), &(name2, dis2, _)| {
(name1, dis1).cmp(&(name2, dis2))
});

self.dep_graph.with_task(DepNode::new_no_params(DepKind::Krate),
&self.hcx,
(node_hashes, crate_disambiguator.to_fingerprint()),
((node_hashes, upstream_crates),
(commandline_args_hash,
crate_disambiguator.to_fingerprint())),
identity_fn);
self.map
}
Expand Down
5 changes: 4 additions & 1 deletion src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,10 @@ pub fn map_crate<'hir>(sess: &::session::Session,
intravisit::walk_crate(&mut collector, &forest.krate);

let crate_disambiguator = sess.local_crate_disambiguator();
collector.finalize_and_compute_crate_hash(crate_disambiguator)
let cmdline_args = sess.opts.dep_tracking_hash();
collector.finalize_and_compute_crate_hash(crate_disambiguator,
cstore,
cmdline_args)
};

if log_enabled!(::log::LogLevel::Debug) {
Expand Down