|
| 1 | +# Challenge 24: Verify the safety of `Vec` functions part 2 |
| 2 | + |
| 3 | +- **Status:** Open |
| 4 | +- **Tracking Issue:** [#285](https://github.com/model-checking/verify-rust-std/issues/285) |
| 5 | +- **Start date:** *2025/03/07* |
| 6 | +- **End date:** *2025/10/17* |
| 7 | +- **Reward:** *15000 USD* |
| 8 | + |
| 9 | +------------------- |
| 10 | + |
| 11 | + |
| 12 | +## Goal |
| 13 | + |
| 14 | +Continue from part 1 (Challenge 23), for this challenge, you need to verify the safety of `std::Vec` iterator functions in other files in (library/alloc/src/vec/). |
| 15 | + |
| 16 | + |
| 17 | +### Success Criteria |
| 18 | + |
| 19 | +Verify the safety of the following functions that in implemented for `IntoIter` in (library/alloc/src/vec/into_iter.rs): |
| 20 | + |
| 21 | +| Function | |
| 22 | +|---------| |
| 23 | +|as_slice| |
| 24 | +|as_mut_slice| |
| 25 | +|forget_allocation_drop_remaining| |
| 26 | +|into_vecdeque| |
| 27 | +|next| |
| 28 | +|size_hint| |
| 29 | +|advance_by| |
| 30 | +|next_chunk| |
| 31 | +|fold| |
| 32 | +|try_fold| |
| 33 | +|__iterator_get_unchecked| |
| 34 | +|next_back| |
| 35 | +|advance_back_by| |
| 36 | +|drop| |
| 37 | + |
| 38 | +and the following functions from other files: |
| 39 | + |
| 40 | +| Function | in File| |
| 41 | +|---------|---------| |
| 42 | +|next| extract_if.rs| |
| 43 | +|spec_extend (for IntoIter) | spec_extend.rs | |
| 44 | +|spec_extend (for slice::Iter) | spec_extend.rs | |
| 45 | +|from_elem (for i8)| spec_from_elem.rs | |
| 46 | +|from_elem (for u8)| spec_from_elem.rs | |
| 47 | +|from_elem (for ())| spec_from_elem.rs | |
| 48 | +|from_iter| spec_from_iter.rs| |
| 49 | +|from_iter (default)| spec_from_iter_nested.rs| |
| 50 | + |
| 51 | + |
| 52 | +The verification must be unbounded---it must hold for slices of arbitrary length. |
| 53 | + |
| 54 | +The verification must hold for generic type `T` (no monomorphization). |
| 55 | + |
| 56 | +### List of UBs |
| 57 | + |
| 58 | +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): |
| 59 | + |
| 60 | +* Accessing (loading from or storing to) a place that is dangling or based on a misaligned pointer. |
| 61 | +* Reading from uninitialized memory except for padding or unions. |
| 62 | +* Mutating immutable bytes. |
| 63 | +* Producing an invalid value |
| 64 | + |
| 65 | + |
| 66 | +Note: All solutions to verification challenges need to satisfy the criteria established in the [challenge book](../general-rules.md) |
| 67 | +in addition to the ones listed above. |
0 commit comments