Verify safety of Vec iterator and specialization functions (Challenge 24) #547
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.
Summary
Resolves #285
Adds Kani verification harnesses for all 21 Vec iterator and specialization functions listed in Challenge 24, across 6 files:
into_iter.rs(13 IntoIter functions):as_slice,as_mut_slice,next,size_hint,advance_by,next_chunk,fold,try_fold,__iterator_get_unchecked,next_back,advance_back_by,drop,forget_allocation_drop_remaining,into_vecdequeextract_if.rs(1 function):ExtractIf::nextspec_extend.rs(2 specializations):spec_extendforIntoIterspec_extendforslice::Iterspec_from_elem.rs(3 specializations):from_elemfori8,u8,()spec_from_iter.rs(1 specialization):from_iterforIntoIterspec_from_iter_nested.rs(1 specialization):from_iter(default impl)Approach
#[kani::unwind(8)]for loop-containing functions, MAX_LEN=3 arraysu8,(),char,(char, u8)— no monomorphizationany_vec<T, MAX_LEN>()creates symbolic Vec instancesVerification
Test plan
rustfmtapplied