File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2218,5 +2218,31 @@ impl<T: ?Sized> PartialOrd for *mut T {
22182218#[ unstable( feature = "kani" , issue = "none" ) ]
22192219mod verify {
22202220 use crate :: kani;
2221-
2221+ macro_rules! generate_unit_harness {
2222+ ( $fn_name: ident, $proof_name: ident) => {
2223+ #[ allow( unused) ]
2224+ #[ kani:: proof_for_contract( <* mut ( ) >:: $fn_name) ]
2225+ pub fn $proof_name( ) {
2226+ let mut test_val: ( ) = ( ) ;
2227+ let test_ptr: * mut ( ) = & mut test_val;
2228+ let count: usize = kani:: any( ) ;
2229+ unsafe {
2230+ test_ptr. $fn_name( count) ;
2231+ }
2232+ }
2233+ } ;
2234+ }
2235+ generate_unit_harness ! ( add, check_mut_add_unit) ;
2236+ generate_unit_harness ! ( sub, check_mut_sub_unit) ;
2237+
2238+ #[ allow( unused) ]
2239+ #[ kani:: proof_for_contract( <* mut ( ) >:: offset) ]
2240+ pub fn check_mut_offset_unit ( ) {
2241+ let mut test_val: ( ) = ( ) ;
2242+ let test_ptr: * mut ( ) = & mut test_val;
2243+ let count: isize = kani:: any ( ) ;
2244+ unsafe {
2245+ test_ptr. offset ( count) ;
2246+ }
2247+ }
22222248}
You can’t perform that action at this time.
0 commit comments