Skip to content

Commit c8aeb5b

Browse files
Add Challenge 25: VecDeque (#269)
This PR adds Challenge 25 for VecDeque By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Michael Tautschnig <[email protected]>
1 parent 02a7a8c commit c8aeb5b

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

doc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@
3535
- [20: Verify the safety of char-related functions in str::pattern](./challenges/0020-str-pattern-pt1.md)
3636
- [21: Verify the safety of substring-related functions in str::pattern](./challenges/0021-str-pattern-pt2.md)
3737
- [22: Verify the safety of str iter functions](./challenges/0022-str-iter.md)
38+
- [25: Verify the safety of `VecDeque` functions](./challenges/0025-vecdeque.md)

doc/src/challenges/0025-vecdeque.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Challenge 25: Verify the safety of `VecDeque` functions
2+
3+
- **Status:** Open
4+
- **Tracking Issue:** [#286](https://github.com/model-checking/verify-rust-std/issues/286)
5+
- **Start date:** *2025-03-07*
6+
- **End date:** *2025-10-17*
7+
- **Reward:** *10000 USD*
8+
9+
-------------------
10+
11+
12+
## Goal
13+
14+
Verify the safety of `VecDeque` functions in (library/alloc/src/collections/vec_deque/mod.rs).
15+
16+
17+
### Success Criteria
18+
19+
Verify the safety of the following functions in (library/alloc/src/collections/vec_deque/mod.rs):
20+
21+
Write and prove the contract for the safety of the following unsafe functions:
22+
23+
| Function |
24+
|---------|
25+
|push_unchecked|
26+
|buffer_read|
27+
|buffer_write|
28+
|buffer_range|
29+
|copy|
30+
|copy_nonoverlapping|
31+
|wrap_copy|
32+
|copy_slice|
33+
|write_iter|
34+
|write_iter_wrapping|
35+
|handle_capacity_increase|
36+
|from_contiguous_raw_parts_in|
37+
|abort_shrink|
38+
39+
Prove the absence of undefined behavior for following safe abstractions:
40+
41+
|get|
42+
|get_mut|
43+
|swap|
44+
|reserve_exact|
45+
|reserve|
46+
|try_reserve_exact|
47+
|try_reserve|
48+
|shrink_to|
49+
|truncate|
50+
|as_slices|
51+
|as_mut_slices|
52+
|range|
53+
|range_mut|
54+
|drain|
55+
|pop_front|
56+
|pop_back|
57+
|push_front|
58+
|push_back|
59+
|insert|
60+
|remove|
61+
|split_off|
62+
|append|
63+
|retain_mut|
64+
|grow|
65+
|resize_with|
66+
|make_contiguous|
67+
|rotate_left|
68+
|rotate_right|
69+
|rotate_left_inner|
70+
|rotate_right_inner|
71+
72+
The verification must be unbounded---it must hold for slices of arbitrary length.
73+
74+
The verification must hold for generic type `T` (no monomorphization).
75+
76+
### List of UBs
77+
78+
All proofs must automatically ensure the absence of the following undefined behaviors [ref](https://github.com/rust-lang/reference/blob/142b2ed77d33f37a9973772bd95e6144ed9dce43/src/behavior-considered-undefined.md):
79+
80+
* Accessing (loading from or storing to) a place that is dangling or based on a misaligned pointer.
81+
* Reading from uninitialized memory except for padding or unions.
82+
* Mutating immutable bytes.
83+
* Producing an invalid value
84+
85+
86+
Note: All solutions to verification challenges need to satisfy the criteria established in the [challenge book](../general-rules.md)
87+
in addition to the ones listed above.

0 commit comments

Comments
 (0)