forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 54
Add Challenge 16: Iterator #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
carolynzech
merged 23 commits into
model-checking:main
from
thanhnguyen-aws:morechallenges
Apr 4, 2025
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6b0fcb1
add empty files
thanhnguyen-aws d42bdf6
add 2 more challenges
thanhnguyen-aws 40b20f4
editing
thanhnguyen-aws 924d752
editing
thanhnguyen-aws fabd40f
editing
thanhnguyen-aws 4a3a0e6
add 10 challenges
thanhnguyen-aws 7437d1e
Merge branch 'model-checking:main' into morechallenges
thanhnguyen-aws 67b6403
fix typos
thanhnguyen-aws 140f95e
fix typo
thanhnguyen-aws b4b7cad
fix type T
thanhnguyen-aws 5a82c7c
Merge branch 'main' into morechallenges
thanhnguyen-aws b9d0e74
fixed challenge 16
thanhnguyen-aws 93207e4
keep only iter challenge
thanhnguyen-aws fd6642e
fix typos
thanhnguyen-aws 2fbbbb0
fix date format
thanhnguyen-aws 2676728
fix typos
thanhnguyen-aws 6279e95
Merge branch 'main' into morechallenges
thanhnguyen-aws 36badcb
fix issue link, reward
thanhnguyen-aws 15f3c83
update SUMMARY.md, separate safe/unsafe functions
thanhnguyen-aws e9caacf
safea abstractions
carolynzech 63540f7
Modify reward
carolynzech 22fa830
Merge branch 'main' into morechallenges
thanhnguyen-aws 28cc08f
Merge branch 'main' into morechallenges
tautschnig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Challenge 16: Verify the safety of Iterator functions | ||
|
||
- **Status:** Open | ||
- **Tracking Issue:** [#280](https://github.com/model-checking/verify-rust-std/issues/280) | ||
- **Start date:** *2025-03-07* | ||
- **End date:** *2025-10-17* | ||
- **Reward:** *10,000 USD* | ||
|
||
------------------- | ||
|
||
|
||
## Goal | ||
|
||
Verify the safety of iter functions that are defined in (library/core/src/iter/adapters): | ||
|
||
|
||
|
||
### Success Criteria | ||
|
||
Write and prove the contract for the safety of the following unsafe functions: | ||
|
||
| Function | Defined in | | ||
|---------| ---------| | ||
|__iterator_get_unchecked| clone.rs| | ||
carolynzech marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|next_unchecked| clone.rs| | ||
|__iterator_get_unchecked| copied.rs| | ||
|__iterator_get_unchecked| enumerate.rs| | ||
|__iterator_get_unchecked | fuse.rs| | ||
|__iterator_get_unchecked | map.rs| | ||
|next_unchecked | map.rs| | ||
|__iterator_get_unchecked | skip.rs| | ||
|__iterator_get_unchecked | zip.rs| | ||
|get_unchecked| zip.rs| | ||
|
||
Prove the absence of undefined behavior for following safe abstractions: | ||
|
||
| Function | Defined in | | ||
|---------| ---------| | ||
|next_back_remainder| array_chunks.rs| | ||
|fold| array_chunks.rs| | ||
|spec_next_chunk| copied.rs| | ||
|next_chunk_dropless| filter.rs| | ||
|next_chunk| filter_map.rs| | ||
|as_array_ref | map_windows.rs| | ||
|as_uninit_array_mut | map_windows.rs| | ||
|push | map_windows.rs| | ||
|drop | map_windows.rs| | ||
|original_step | step_by.rs| | ||
|spec_fold| take.rs| | ||
|spec_for_each| take.rs| | ||
|fold| zip.rs| | ||
|next| zip.rs| | ||
|nth| zip.rs| | ||
|next_back| zip.rs| | ||
|spec_fold| zip.rs| | ||
|
||
|
||
|
||
The verification must be unbounded---it must hold for slices of arbitrary length. | ||
|
||
The verification must hold for generic type `T` (no monomorphization). | ||
|
||
### List of UBs | ||
|
||
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): | ||
|
||
* Accessing (loading from or storing to) a place that is dangling or based on a misaligned pointer. | ||
* Reading from uninitialized memory except for padding or unions. | ||
* Mutating immutable bytes. | ||
* Producing an invalid value | ||
|
||
|
||
Note: All solutions to verification challenges need to satisfy the criteria established in the [challenge book](../general-rules.md) | ||
in addition to the ones listed above. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.