From ecef994d8ae0b61fb0db170c4304f6b53eea3c3c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 16 May 2022 03:08:23 +0100 Subject: [PATCH] spec loop detecton: Write down the rule Signed-off-by: Ian Jackson --- src/gamestate.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gamestate.rs b/src/gamestate.rs index 62cd3b39..700fc1b0 100644 --- a/src/gamestate.rs +++ b/src/gamestate.rs @@ -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() -- 2.30.2