chiark / gitweb /
spec loop detecton: Write down the rule
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 16 May 2022 02:08:23 +0000 (03:08 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 16 May 2022 02:09:35 +0000 (03:09 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/gamestate.rs

index 62cd3b39f06f4ffc5dff7daf8c0605bf720ca7c2..700fc1b021666125b77f5c1baea05bc9ff2c5e65 100644 (file)
@@ -412,6 +412,18 @@ impl SpecDepth {
 }
 
 impl<'a> PieceLoadArgs<'a> {
+  /// Call when recursing to not-strictly-weaker method
+  ///
+  /// Call this when your implementation of any PieceTrait method
+  /// calls another PieceTrait method from another object,
+  /// unless the call is *strictly* lower in the following hierarchy:
+  ///
+  ///  * `load`
+  ///  * `load_inert`
+  ///  * `count` with nonempty `PieceAliases`
+  ///  * `count` with empty `PieceAliases`
+  ///
+  /// If this rule is followed, recursion will be bounded.
   #[throws(SpE)]
   pub fn recursing(mut self) -> Self {
     self.depth = self.depth.increment()