Skip to content

Commit 9d61f06

Browse files
Rollup merge of rust-lang#87138 - dhwthompson:fix-range-invariant, r=JohnTitor
Correct invariant documentation for `steps_between` Given that the previous example involves stepping forward from A to B, the equivalent example on this line would make most sense as stepping backward from B to A. I should probably add a caveat here that I’m fairly new to Rust, and this is my first contribution to this repo, so it’s very possible that I’ve misunderstood how this is supposed to work (either on a technical level or a social one). If this is the case, please do let me know.
2 parents 249e403 + 99ed1b5 commit 9d61f06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/iter/range.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub trait Step: Clone + PartialOrd + Sized {
3030
/// For any `a`, `b`, and `n`:
3131
///
3232
/// * `steps_between(&a, &b) == Some(n)` if and only if `Step::forward_checked(&a, n) == Some(b)`
33-
/// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&a, n) == Some(a)`
33+
/// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&b, n) == Some(a)`
3434
/// * `steps_between(&a, &b) == Some(n)` only if `a <= b`
3535
/// * Corollary: `steps_between(&a, &b) == Some(0)` if and only if `a == b`
3636
/// * Note that `a <= b` does _not_ imply `steps_between(&a, &b) != None`;

0 commit comments

Comments
 (0)