Skip to content

Commit 4168c25

Browse files
author
Markus Westerlind
committed
refactor: Add an alias for the SmallVec in dep_graph
1 parent c6f1215 commit 4168c25

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/librustc/dep_graph/graph.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,7 @@ impl DepGraph {
350350
{
351351
if let Some(ref data) = self.data {
352352
let (result, task_deps) = ty::tls::with_context(|icx| {
353-
let task_deps = Lock::new(TaskDeps {
354-
#[cfg(debug_assertions)]
355-
node: None,
356-
reads: SmallVec::new(),
357-
read_set: Default::default(),
358-
});
353+
let task_deps = Lock::new(TaskDeps::default());
359354

360355
let r = {
361356
let icx = ty::tls::ImplicitCtxt { task_deps: Some(&task_deps), ..icx.clone() };
@@ -968,7 +963,7 @@ pub enum WorkProductFileKind {
968963
#[derive(Clone)]
969964
struct DepNodeData {
970965
node: DepNode,
971-
edges: SmallVec<[DepNodeIndex; 8]>,
966+
edges: EdgesVec,
972967
fingerprint: Fingerprint,
973968
}
974969

@@ -1093,7 +1088,7 @@ impl CurrentDepGraph {
10931088
fn alloc_node(
10941089
&self,
10951090
dep_node: DepNode,
1096-
edges: SmallVec<[DepNodeIndex; 8]>,
1091+
edges: EdgesVec,
10971092
fingerprint: Fingerprint,
10981093
) -> DepNodeIndex {
10991094
debug_assert!(
@@ -1105,7 +1100,7 @@ impl CurrentDepGraph {
11051100
fn intern_node(
11061101
&self,
11071102
dep_node: DepNode,
1108-
edges: SmallVec<[DepNodeIndex; 8]>,
1103+
edges: EdgesVec,
11091104
fingerprint: Fingerprint,
11101105
) -> DepNodeIndex {
11111106
match self.node_to_node_index.get_shard_by_value(&dep_node).lock().entry(dep_node) {
@@ -1168,11 +1163,14 @@ impl DepGraphData {
11681163
}
11691164
}
11701165

1166+
/// The capacity of the `reads` field `SmallVec`
11711167
const TASK_DEPS_READS_CAP: usize = 8;
1168+
type EdgesVec = SmallVec<[DepNodeIndex; TASK_DEPS_READS_CAP]>;
1169+
#[derive(Default)]
11721170
pub struct TaskDeps {
11731171
#[cfg(debug_assertions)]
11741172
node: Option<DepNode>,
1175-
reads: SmallVec<[DepNodeIndex; TASK_DEPS_READS_CAP]>,
1173+
reads: EdgesVec,
11761174
read_set: FxHashSet<DepNodeIndex>,
11771175
}
11781176

0 commit comments

Comments
 (0)