diff options
| author | Amanda Stjerna <amanda.stjerna@it.uu.se> | 2024-05-21 10:57:32 +0200 | 
|---|---|---|
| committer | Amanda Stjerna <amanda.stjerna@it.uu.se> | 2024-06-12 15:47:32 +0200 | 
| commit | 3bdcb9d4368c2404955499c0e66c991a706ca4a4 (patch) | |
| tree | e65c60bf7f0369b3dbd5cec4b89eec0110e8aae6 /compiler/rustc_data_structures/src/graph/scc | |
| parent | e6eb63d4b9c384296233ec46c37a7ffebe526ea3 (diff) | |
| download | rust-3bdcb9d4368c2404955499c0e66c991a706ca4a4.tar.gz rust-3bdcb9d4368c2404955499c0e66c991a706ca4a4.zip  | |
Revise documentation after @lqd's comments
Diffstat (limited to 'compiler/rustc_data_structures/src/graph/scc')
| -rw-r--r-- | compiler/rustc_data_structures/src/graph/scc/mod.rs | 12 | 
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs index 22b029c2bd4..40d1d8d11d3 100644 --- a/compiler/rustc_data_structures/src/graph/scc/mod.rs +++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs @@ -22,12 +22,9 @@ mod tests; /// An annotation for an SCC. This can be a representative, /// the max/min element of the SCC, or all of the above. /// -/// Concretely, the following properties must hold (where `merge` -/// is `merge_scc` and `merge_reached`): -/// - idempotency: `a.merge(a) = a` -/// - commutativity: `a.merge(b) = b.merge(a)` +/// Concretely, the both merge operations must commute, e.g. where `merge` +/// is `merge_scc` and `merge_reached`: `a.merge(b) == b.merge(a)` /// -/// This is rather limiting and precludes, for example, counting. /// In general, what you want is probably always min/max according /// to some ordering, potentially with side constraints (min x such /// that P holds). @@ -62,7 +59,7 @@ impl Annotation for () { /// the index type for the graph nodes and `S` is the index type for /// the SCCs. We can map from each node to the SCC that it /// participates in, and we also have the successors of each SCC. -pub struct Sccs<N: Idx, S: Idx, A: Annotation> { +pub struct Sccs<N: Idx, S: Idx, A: Annotation = ()> { /// For each node, what is the SCC index of the SCC to which it /// belongs. scc_indices: IndexVec<N, S>, @@ -314,8 +311,7 @@ where /// D' (i.e., D' < D), we know that N, N', and all nodes in /// between them on the stack are part of an SCC. /// - /// Additionally, we keep track of a representative annotation of the - /// SCC. + /// Additionally, we keep track of a current annotation of the SCC. /// /// [wikipedia]: https://bit.ly/2EZIx84 fn construct(graph: &'c G, to_annotation: F) -> Sccs<G::Node, S, A> {  | 
