Skip to content

Commit

Permalink
polymorphic interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Matias Scharager committed Jul 30, 2024
1 parent 69d3a75 commit 493c768
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/slice/sort/unstable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ mod verify {

#[kani::modifies(v)]
#[kani::ensures(|_| v.is_sorted_by(is_less.clone()))]
pub fn sort_u32<T, F: FnMut(&T, &T) -> bool + Clone>(v: &mut [T], is_less: &mut F) {
pub fn sort_clone<T, F: FnMut(&T, &T) -> bool + Clone>(v: &mut [T], is_less: &mut F) {
sort(v,is_less)
}

#[kani::proof_for_contract(sort_u32)]
pub fn sort_harness(){
let mut arr: [u32; 1] = crate::array::from_fn(|_| kani::any::<u32>());
let x : &mut [u32] = arr.as_mut_slice();
sort_u32(x,&mut |a,b| a < b)
sort_clone(x,&mut |a,b| a < b)
}
}

0 comments on commit 493c768

Please sign in to comment.