Skip to content

Commit 15f3c83

Browse files
update SUMMARY.md, separate safe/unsafe functions
1 parent 36badcb commit 15f3c83

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

doc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@
2929
- [13: Safety of `CStr`](./challenges/0013-cstr.md)
3030
- [14: Safety of Primitive Conversions](./challenges/0014-convert-num.md)
3131
- [15: Contracts and Tests for SIMD Intrinsics](./challenges/0015-intrinsics-simd.md)
32+
- [16: Verify the safety of Iterator functions](./challenges/0016-iter.md)

doc/src/challenges/0016-iter.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,45 @@ Verify the safety of iter functions that are defined in (library/core/src/iter/a
1717

1818
### Success Criteria
1919

20-
Write and prove the contract for the safety of the following functions:
20+
Write and prove the contract for the safety of the following unsafe functions:
2121

2222
| Function | Defined in |
2323
|---------| ---------|
24-
|next_back_remainder| array_chunks.rs|
25-
|fold| array_chunks.rs|
2624
|__iterator_get_unchecked| clone.rs|
27-
|fold| clone.rs|
2825
|next_unchecked| clone.rs|
2926
|__iterator_get_unchecked| copied.rs|
30-
|spec_next_chunk| copied.rs|
3127
|__iterator_get_unchecked| enumerate.rs|
32-
|next_chunk| filter.rs|
33-
|next_chunk| filter_map.rs|
3428
|__iterator_get_unchecked | fuse.rs|
3529
|__iterator_get_unchecked | map.rs|
3630
|next_unchecked | map.rs|
31+
|__iterator_get_unchecked | skip.rs|
32+
|__iterator_get_unchecked | zip.rs|
33+
|get_unchecked| zip.rs|
34+
35+
Prove the absence of UB for following safe functions:
36+
37+
| Function | Defined in |
38+
|---------| ---------|
39+
|next_back_remainder| array_chunks.rs|
40+
|fold| array_chunks.rs|
41+
|spec_next_chunk| copied.rs|
42+
|next_chunk_dropless| filter.rs|
43+
|next_chunk| filter_map.rs|
3744
|as_array_ref | map_windows.rs|
3845
|as_uninit_array_mut | map_windows.rs|
3946
|push | map_windows.rs|
4047
|drop | map_windows.rs|
41-
|__iterator_get_unchecked | skip.rs|
4248
|original_step | step_by.rs|
4349
|spec_fold| take.rs|
4450
|spec_for_each| take.rs|
45-
|__iterator_get_unchecked | zip.rs|
46-
|get_unchecked| zip.rs|
4751
|fold| zip.rs|
4852
|next| zip.rs|
4953
|nth| zip.rs|
5054
|next_back| zip.rs|
5155
|spec_fold| zip.rs|
5256

57+
58+
5359
The verification must be unbounded---it must hold for slices of arbitrary length.
5460

5561
The verification must hold for generic type `T` (no monomorphization).

0 commit comments

Comments
 (0)