Skip to content

Commit

Permalink
Merge branch 'transmute_unchecked' of https://github.com/AlexLB99/ver…
Browse files Browse the repository at this point in the history
…ify-rust-std into transmute_unchecked
  • Loading branch information
AlexLB99 committed Dec 3, 2024
2 parents 3e596c2 + f813be8 commit b86e230
Show file tree
Hide file tree
Showing 3 changed files with 503 additions and 16 deletions.
17 changes: 15 additions & 2 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,20 @@ mod verify {
assert!(c_str.is_safe());
}
}


#[kani::proof]
#[kani::unwind(17)]
fn check_from_bytes_with_nul() {
const MAX_SIZE: usize = 16;
let string: [u8; MAX_SIZE] = kani::any();
let slice = kani::slice::any_slice_of_array(&string);

let result = CStr::from_bytes_with_nul(slice);
if let Ok(c_str) = result {
assert!(c_str.is_safe());
}
}

// pub const fn count_bytes(&self) -> usize
#[kani::proof]
#[kani::unwind(32)]
Expand Down Expand Up @@ -956,4 +969,4 @@ mod verify {
assert_eq!(expected_is_empty, c_str.is_empty());
assert!(c_str.is_safe());
}
}
}
Loading

0 comments on commit b86e230

Please sign in to comment.