@@ -1887,7 +1887,7 @@ fn simd_contains(needle: &str, haystack: &str) -> Option<bool> {
18871887/// # Safety
18881888///
18891889/// Both slices must have the same length.
1890- #[ cfg( all( target_arch = "x86_64" , target_feature = "sse2" ) ) ] // only called on x86
1890+ #[ cfg( all( target_arch = "x86_64" , any ( kani , target_feature = "sse2" ) ) ) ] // only called on x86
18911891#[ inline]
18921892#[ requires( x. len( ) == y. len( ) ) ]
18931893unsafe fn small_slice_eq ( x : & [ u8 ] , y : & [ u8 ] ) -> bool {
@@ -1958,17 +1958,13 @@ unsafe fn small_slice_eq(x: &[u8], y: &[u8]) -> bool {
19581958pub mod verify {
19591959 use super :: * ;
19601960
1961+ // Copied from https://github.com/model-checking/kani/blob/main/library/kani/src/slice.rs
1962+ // should be removed when these functions are moved to `kani_core`
19611963 pub fn any_slice_of_array < T , const LENGTH : usize > ( arr : & [ T ; LENGTH ] ) -> & [ T ] {
19621964 let ( from, to) = any_range :: < LENGTH > ( ) ;
19631965 & arr[ from..to]
19641966 }
19651967
1966- /// A mutable version of the previous function
1967- pub fn any_slice_of_array_mut < T , const LENGTH : usize > ( arr : & mut [ T ; LENGTH ] ) -> & mut [ T ] {
1968- let ( from, to) = any_range :: < LENGTH > ( ) ;
1969- & mut arr[ from..to]
1970- }
1971-
19721968 fn any_range < const LENGTH : usize > ( ) -> ( usize , usize ) {
19731969 let from: usize = kani:: any ( ) ;
19741970 let to: usize = kani:: any ( ) ;
@@ -1977,14 +1973,16 @@ pub mod verify {
19771973 ( from, to)
19781974 }
19791975
1980- #[ cfg( all( target_arch = "x86_64" , target_feature = "sse2 " ) ) ] // only called on x86
1976+ #[ cfg( all( kani , target_arch = "x86_64 " ) ) ] // only called on x86
19811977 #[ kani:: proof]
1978+ #[ kani:: unwind( 4 ) ]
19821979 pub fn check_small_slice_eq ( ) {
19831980 const ARR_SIZE : usize = 1000 ;
19841981 let x: [ u8 ; ARR_SIZE ] = kani:: any ( ) ;
19851982 let y: [ u8 ; ARR_SIZE ] = kani:: any ( ) ;
19861983 let xs = any_slice_of_array ( & x) ;
19871984 let ys = any_slice_of_array ( & y) ;
1985+ kani:: assume ( xs. len ( ) == ys. len ( ) ) ;
19881986 unsafe {
19891987 small_slice_eq ( xs, ys) ;
19901988 }
0 commit comments