Skip to content

Commit 3bdcb9d

Browse files
committed
Revise documentation after @lqd's comments
1 parent e6eb63d commit 3bdcb9d

File tree

2 files changed

+5
-9
lines changed
  • compiler

2 files changed

+5
-9
lines changed

compiler/rustc_data_structures/src/graph/scc/mod.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@ mod tests;
2222
/// An annotation for an SCC. This can be a representative,
2323
/// the max/min element of the SCC, or all of the above.
2424
///
25-
/// Concretely, the following properties must hold (where `merge`
26-
/// is `merge_scc` and `merge_reached`):
27-
/// - idempotency: `a.merge(a) = a`
28-
/// - commutativity: `a.merge(b) = b.merge(a)`
25+
/// Concretely, the both merge operations must commute, e.g. where `merge`
26+
/// is `merge_scc` and `merge_reached`: `a.merge(b) == b.merge(a)`
2927
///
30-
/// This is rather limiting and precludes, for example, counting.
3128
/// In general, what you want is probably always min/max according
3229
/// to some ordering, potentially with side constraints (min x such
3330
/// that P holds).
@@ -62,7 +59,7 @@ impl Annotation for () {
6259
/// the index type for the graph nodes and `S` is the index type for
6360
/// the SCCs. We can map from each node to the SCC that it
6461
/// participates in, and we also have the successors of each SCC.
65-
pub struct Sccs<N: Idx, S: Idx, A: Annotation> {
62+
pub struct Sccs<N: Idx, S: Idx, A: Annotation = ()> {
6663
/// For each node, what is the SCC index of the SCC to which it
6764
/// belongs.
6865
scc_indices: IndexVec<N, S>,
@@ -314,8 +311,7 @@ where
314311
/// D' (i.e., D' < D), we know that N, N', and all nodes in
315312
/// between them on the stack are part of an SCC.
316313
///
317-
/// Additionally, we keep track of a representative annotation of the
318-
/// SCC.
314+
/// Additionally, we keep track of a current annotation of the SCC.
319315
///
320316
/// [wikipedia]: https://bit.ly/2EZIx84
321317
fn construct(graph: &'c G, to_annotation: F) -> Sccs<G::Node, S, A> {

compiler/rustc_infer/src/infer/region_constraints/leak_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ struct MiniGraph<'tcx> {
360360
/// Map from node index to SCC, and stores the successors of each SCC. All
361361
/// the regions in the same SCC are equal to one another, and if `S1 -> S2`,
362362
/// then `S1: S2`.
363-
sccs: Sccs<LeakCheckNode, LeakCheckScc, ()>,
363+
sccs: Sccs<LeakCheckNode, LeakCheckScc>,
364364
}
365365

366366
impl<'tcx> MiniGraph<'tcx> {

0 commit comments

Comments
 (0)