Skip to content

Commit 46d3568

Browse files
committed
Docstring for for Annotation
Note that this changes no executing code. The change is 100% in documentation.
1 parent c510e73 commit 46d3568

File tree

1 file changed

+12
-2
lines changed
  • compiler/rustc_data_structures/src/graph/scc

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,20 @@ use tracing::{debug, instrument};
2020
mod tests;
2121

2222
/// An annotation for an SCC. This can be a representative,
23-
/// or the max/min element of the SCC, or all of the above.
23+
/// the max/min element of the SCC, or all of the above.
24+
///
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)`
29+
///
30+
/// This is rather limiting and precludes, for example, counting.
31+
/// In general, what you want is probably always min/max according
32+
/// to some ordering, potentially with side constraints (min x such
33+
/// that P holds).
2434
pub trait Annotation: Debug + Copy {
2535
/// Merge two existing annotations into one during
26-
/// path compression.
36+
/// path compression.o
2737
fn merge_scc(self, other: Self) -> Self;
2838

2939
/// Merge a successor into this annotation.

0 commit comments

Comments
 (0)