diff options
| author | Amanda Stjerna <amanda.stjerna@it.uu.se> | 2024-05-17 16:55:38 +0200 |
|---|---|---|
| committer | Amanda Stjerna <amanda.stjerna@it.uu.se> | 2024-06-12 15:47:32 +0200 |
| commit | 14c10ec88e3766868b9fe94458385fad3c3f8a7e (patch) | |
| tree | d9b0cf613ff97d98b0a1547bf459ec767f070468 /compiler/rustc_data_structures | |
| parent | 582c613be80f7b308972290773b23cac39c4b7d7 (diff) | |
| download | rust-14c10ec88e3766868b9fe94458385fad3c3f8a7e.tar.gz rust-14c10ec88e3766868b9fe94458385fad3c3f8a7e.zip | |
Docstring for for `Annotation`
Note that this changes no executing code. The change is 100% in documentation.
Diffstat (limited to 'compiler/rustc_data_structures')
| -rw-r--r-- | compiler/rustc_data_structures/src/graph/scc/mod.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs index e7ec2f97505..5fb99e7ada4 100644 --- a/compiler/rustc_data_structures/src/graph/scc/mod.rs +++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs @@ -20,10 +20,20 @@ use tracing::{debug, instrument}; mod tests; /// An annotation for an SCC. This can be a representative, -/// or the max/min element of the SCC, or all of the above. +/// 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)` +/// +/// 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). pub trait Annotation: Debug + Copy { /// Merge two existing annotations into one during - /// path compression. + /// path compression.o fn merge_scc(self, other: Self) -> Self; /// Merge a successor into this annotation. |
