Skip to content
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
4 changes: 3 additions & 1 deletion compiler/rustc_middle/src/dep_graph/retained.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ impl RetainedDepGraph {
Self { inner, indices }
}

/// Adds `node` at its dep-graph index. Indices are allocated to threads in batches, so the
/// index space is sparse and the slots skipped over hold no node.
pub fn push(&mut self, index: DepNodeIndex, node: DepNode, edges: &[DepNodeIndex]) {
let source = NodeIndex(index.as_usize());
self.inner.add_node_with_idx(source, node);
Expand All @@ -37,7 +39,7 @@ impl RetainedDepGraph {
}

pub fn nodes(&self) -> Vec<&DepNode> {
self.inner.all_nodes().iter().map(|n| n.data.as_ref().unwrap()).collect()
self.inner.all_nodes().iter().filter_map(|n| n.data.as_ref()).collect()
}

pub fn edges(&self) -> Vec<(&DepNode, &DepNode)> {
Expand Down
24 changes: 14 additions & 10 deletions tests/run-make/dep-graph/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
// Just verify that we successfully run and produce dep graphs when requested.
// Just verify that we successfully run and produce dep graphs when requested. The parallel
// frontend is covered too, because it leaves unused dep-graph indices that the dump must skip.

//@ ignore-cross-compile

use run_make_support::{path, rustc};

fn main() {
rustc()
.input("foo.rs")
.incremental(path("incr"))
.arg("-Zquery-dep-graph")
.arg("-Zdump-dep-graph")
.env("RUST_DEP_GRAPH", path("dep-graph"))
.run();
for threads in ["1", "2"] {
rustc()
.input("foo.rs")
.incremental(path(format!("incr-{threads}")))
.arg("-Zquery-dep-graph")
.arg("-Zdump-dep-graph")
.arg(format!("-Zthreads={threads}"))
.env("RUST_DEP_GRAPH", path(format!("dep-graph-{threads}")))
.run();

assert!(path("dep-graph.txt").is_file());
assert!(path("dep-graph.dot").is_file());
assert!(path(format!("dep-graph-{threads}.txt")).is_file());
assert!(path(format!("dep-graph-{threads}.dot")).is_file());
}
}
Loading