add task for linking

In MSVC (at least), linking requires accessing metadata, which generates
reads.
This commit is contained in:
Niko Matsakis 2016-05-18 09:23:40 -04:00
parent 4d3ef6b63d
commit f860f8b7c9
2 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,7 @@ pub enum DepNode<D: Clone + Debug> {
TransCrateItem(D),
TransInlinedItem(D),
TransWriteMetadata,
LinkBinary,
// Nodes representing bits of computed IR in the tcx. Each shared
// table in the tcx (or elsewhere) maps to one of these
@ -178,6 +179,7 @@ pub fn map_def<E, OP>(&self, mut op: OP) -> Option<DepNode<E>>
LateLintCheck => Some(LateLintCheck),
TransCrate => Some(TransCrate),
TransWriteMetadata => Some(TransWriteMetadata),
LinkBinary => Some(LinkBinary),
Hir(ref d) => op(d).map(Hir),
MetaData(ref d) => op(d).map(MetaData),
CollectItem(ref d) => op(d).map(CollectItem),

View File

@ -25,6 +25,7 @@
use CrateTranslation;
use util::common::time;
use util::fs::fix_windows_verbatim_for_gcc;
use rustc::dep_graph::DepNode;
use rustc::ty::TyCtxt;
use rustc_back::tempdir::TempDir;
@ -183,6 +184,8 @@ pub fn link_binary(sess: &Session,
trans: &CrateTranslation,
outputs: &OutputFilenames,
crate_name: &str) -> Vec<PathBuf> {
let _task = sess.dep_graph.in_task(DepNode::LinkBinary);
let mut out_filenames = Vec::new();
for &crate_type in sess.crate_types.borrow().iter() {
if invalid_output_for_target(sess, crate_type) {