forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 50
Add challenge 23 24 for Vec #267
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
Open
thanhnguyen-aws
wants to merge
13
commits into
model-checking:main
Choose a base branch
from
thanhnguyen-aws:vecchallenge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1f9ac98
add files
thanhnguyen-aws dc48c06
Merge branch 'main' into vecchallenge
thanhnguyen-aws ad19f48
Merge branch 'main' into vecchallenge
thanhnguyen-aws e9d20ef
fix date format
thanhnguyen-aws b2e240b
fix typos
thanhnguyen-aws 45777b0
fix issue link, reward
thanhnguyen-aws df4d0e1
Merge branch 'main' into vecchallenge
thanhnguyen-aws bf153ff
update summary.md
thanhnguyen-aws 73a6f27
Merge branch 'main' into vecchallenge
thanhnguyen-aws b540e67
Merge branch 'main' into vecchallenge
thanhnguyen-aws 9330f29
update reward
thanhnguyen-aws 1806a42
increase reward
thanhnguyen-aws 7497759
increase reward
thanhnguyen-aws 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,78 @@ | ||
# Challenge 23: Verify the safety of `Vec` functions part 1 | ||
|
||
- **Status:** Open | ||
- **Tracking Issue:** [#284](https://github.com/model-checking/verify-rust-std/issues/284) | ||
- **Start date:** *2025-03-07* | ||
- **End date:** *2025-10-17* | ||
- **Reward:** *15000 USD* | ||
|
||
------------------- | ||
|
||
|
||
## Goal | ||
|
||
Verify the safety of `std::Vec` functions (library/alloc/src/vec/mod.rs). | ||
|
||
|
||
### Success Criteria | ||
|
||
Verify the safety of the following public functions in (library/alloc/src/vec/mod.rs): | ||
|
||
| Function | | ||
|---------| | ||
|from_raw_parts| | ||
|from_nonnull| | ||
|from_nonnull_in| | ||
|into_raw_parts_with_alloc| | ||
|into_boxed_slice| | ||
|truncate| | ||
|set_len| | ||
|swap_remove| | ||
|insert| | ||
|remove| | ||
|retain_mut| | ||
|dedup_by| | ||
|push| | ||
|push_within_capacity| | ||
|pop| | ||
|append| | ||
|append_elements| | ||
|drain| | ||
|clear| | ||
|split_off| | ||
|leak| | ||
|spare_capacity_mut| | ||
|split_at_spare_mut| | ||
|split_at_spare_mut_with_len| | ||
|extend_from_within| | ||
|into_flattened| | ||
|extend_with| | ||
|spec_extend_from_within| | ||
|deref| | ||
|deref_mut| | ||
|into_iter| | ||
|extend_desugared| | ||
|extend_trusted| | ||
|extract_if| | ||
|drop| | ||
|try_from| | ||
|
||
|
||
|
||
|
||
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. |
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,67 @@ | ||
# Challenge 24: Verify the safety of `Vec` functions part 2 | ||
|
||
- **Status:** Open | ||
- **Tracking Issue:** [#285](https://github.com/model-checking/verify-rust-std/issues/285) | ||
- **Start date:** *2025/03/07* | ||
- **End date:** *2025/10/17* | ||
- **Reward:** *15000 USD* | ||
|
||
------------------- | ||
|
||
|
||
## Goal | ||
|
||
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/). | ||
|
||
|
||
### Success Criteria | ||
|
||
Verify the safety of the following functions that in implemented for `IntoIter` in (library/alloc/src/vec/into_iter.rs): | ||
|
||
| Function | | ||
|---------| | ||
|as_slice| | ||
|as_mut_slice| | ||
|forget_allocation_drop_remaining| | ||
tautschnig marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|into_vecdeque| | ||
|next| | ||
|size_hint| | ||
|advance_by| | ||
|next_chunk| | ||
|fold| | ||
|try_fold| | ||
|__iterator_get_unchecked| | ||
|next_back| | ||
|advance_back_by| | ||
|drop| | ||
|
||
and the following functions from other files: | ||
|
||
| Function | in File| | ||
|---------|---------| | ||
|next| extract_if.rs| | ||
|spec_extend (for IntoIter) | spec_extend.rs | | ||
|spec_extend (for slice::Iter) | spec_extend.rs | | ||
|from_elem (for i8)| spec_from_elem.rs | | ||
|from_elem (for u8)| spec_from_elem.rs | | ||
|from_elem (for ())| spec_from_elem.rs | | ||
|from_iter| spec_from_iter.rs| | ||
|from_iter (default)| spec_from_iter_nested.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. |
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.