Skip to content

Commit 57e0d9d

Browse files
committed
Clarify comments on TaskDeps.
To make clear some things I wasn't sure about.
1 parent baaab5c commit 57e0d9d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • compiler/rustc_middle/src/dep_graph

compiler/rustc_middle/src/dep_graph/graph.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,13 +1222,14 @@ pub struct TaskDeps {
12221222
#[cfg(debug_assertions)]
12231223
node: Option<DepNode>,
12241224

1225-
/// A vector of `DepNodeIndex`, basically.
1225+
/// A vector of `DepNodeIndex`, basically. Contains no duplicates.
12261226
reads: EdgesVec,
12271227

1228-
/// When adding new edges to `reads` in `DepGraph::read_index` we need to determine if the edge
1229-
/// has been seen before. If the number of elements in `reads` is small, we just do a linear
1230-
/// scan. If the number is higher, a hashset has better perf. This field is that hashset. It's
1231-
/// only used if the number of elements in `reads` exceeds `LINEAR_SCAN_MAX`.
1228+
/// When adding a new edge to `reads` in `DepGraph::read_index` we must determine if the edge
1229+
/// has been seen before. We just do a linear scan of `reads` if its length is less than or
1230+
/// equal to `LINEAR_SCAN_MAX`. Otherwise, we use this hashset for better performance. Note:
1231+
/// `reads` is always the canonical edges representation; this field is just to speed up the
1232+
/// seen-before test.
12321233
read_set: FxHashSet<DepNodeIndex>,
12331234
}
12341235

0 commit comments

Comments
 (0)