Skip to content

Commit 2a4f04c

Browse files
authored
Fix doc (#1492)
* Add test_peek_mut anchor in peek_mut_pledges.rs * Update panic.md * Update peek.md
1 parent c1a5b12 commit 2a4f04c

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

docs/user-guide/src/tour/peek.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> **Recommended reading:**
44
> [3.3: Peek](https://rust-unofficial.github.io/too-many-lists/second-peek.html)
55
6-
Ideally, we could implement `peek` and `try_peek` like we implemented `pop` and `try_pop` before. Like `pop`, `push` can only be called if the list is non-empty, and it then always returns a reference to the element at the head of the list (type `&T`). Similarly, `try_peek` can be called on any list, but returns an `Option<&T>`. The latter is currently not possible in Prusti, since structures containing references are not supported at the moment.
6+
Ideally, we could implement `peek` and `try_peek` like we implemented `pop` and `try_pop` before. Like `pop`, `peek` can only be called if the list is non-empty, and it then always returns a reference to the element at the head of the list (type `&T`). Similarly, `try_peek` can be called on any list, but returns an `Option<&T>`. The latter is currently not possible in Prusti, since structures containing references are not supported at the moment.
77

88
<!-- TODO: link capabilities/limitations chapter (refs in structs) -->
99

@@ -27,4 +27,4 @@ Here you can see the full code we have now:
2727
```rust,noplaypen
2828
// Expand to see full code up to this chapter
2929
{{#rustdoc_include ../../../../prusti-tests/tests/verify/pass/user-guide/peek.rs:nothing}}
30-
```
30+
```

docs/user-guide/src/verify/panic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ error[P0004]: unreachable!(..) statement might be reachable
2222
This message correctly points out that the `unreachable!()` statement might actually be reachable.
2323

2424
The message says "might" because Prusti is conservative, i.e., it reports a verification error *unless* it can prove that the statement is unreachable.
25-
Hence, Prusti successfully the example below as it can rule out that the condition in the conditional statement, `a <= 0`, holds.
25+
Hence, Prusti successfully verified the example below as it can rule out that the condition in the conditional statement, `a <= 0`, holds.
2626

2727
```rust,noplaypen,ignore
2828
pub fn main() {

prusti-tests/tests/verify/pass/user-guide/peek_mut_pledges.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ mod prusti_tests {
218218
prusti_assert!(*list.peek() == 16);
219219
}
220220

221+
//// ANCHOR: test_peek_mut
221222
fn _test_peek_mut() {
222223
let mut list = List::new();
223224
list.push(8);
@@ -238,4 +239,5 @@ mod prusti_tests {
238239
prusti_assert!(*list.lookup(0) == 5); // slot 0 is now `5`
239240
prusti_assert!(*list.lookup(1) == 8); // slot 1 is unchanged
240241
}
241-
}
242+
//// ANCHOR_END: test_peek_mut
243+
}

0 commit comments

Comments
 (0)