Skip to content

Commit 45bc027

Browse files
committed
docs: clarify condition ordering and improve wording
1 parent 1a4302e commit 45bc027

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ Contracts are built from conditions, which come in three flavors:
8585

8686
- **Invariants** (using `maintains: <conditions>`): A convenience for conditions that must hold true both before and after the function runs. It's most useful for expressing properties of `self` that a method must preserve.
8787

88-
For convenience `<conditions>` can be either a single condition or a list (i.e. `[<condition>, <condition>, ...]`).
88+
For convenience, `<conditions>` can be either a single condition or a list (i.e. `[<condition>, <condition>, ...]`).
8989

90-
The conditions must be given in the following order: `requires`, `maintains`, and `ensures`.
90+
The conditions must be given in the following order: `requires`, `maintains`, and `ensures`. This order is enforced to mirror the logical flow of a function's execution: preconditions (`requires`) are checked upon entry, invariants (`maintains`) must hold true upon both entry and exit, and postconditions (`ensures`) are checked upon exit.
9191

9292
A condition is a `bool`-valued Rust expression; as simple as that. This is a non-trivial design choice, so its benefits are explained in the section below: [Why Conditions Are Rust Expressions](#why-conditions-are-rust-expressions).
9393

0 commit comments

Comments
 (0)