Skip to content

Commit aca0f56

Browse files
committed
Address comments
1 parent 8b4f971 commit aca0f56

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@
230230
#![feature(unboxed_closures)]
231231
#![feature(unsized_fn_params)]
232232
#![feature(with_negative_coherence)]
233+
// Required for Kani loop contracts, which are annotated as custom stmt attributes.
233234
#![feature(proc_macro_hygiene)]
234235
// tidy-alphabetical-end
235236
//

library/core/src/slice/ascii.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ const fn is_ascii(s: &[u8]) -> bool {
403403
// tail is always one `usize` at most to extra branch `byte_pos == len`.
404404
#[safety::loop_invariant(byte_pos <= len
405405
&& byte_pos >= offset_to_aligned
406-
&& word_ptr as usize >= start as usize + offset_to_aligned
407-
&& (byte_pos - offset_to_aligned) == (word_ptr as usize - start as usize - offset_to_aligned))]
406+
&& word_ptr.addr() >= start.addr() + offset_to_aligned
407+
&& byte_pos == word_ptr.addr() - start.addr())]
408408
while byte_pos < len - USIZE_SIZE {
409409
// Sanity check that the read is in bounds
410410
debug_assert!(byte_pos + USIZE_SIZE <= len);
@@ -449,7 +449,7 @@ pub mod verify {
449449
#[kani::unwind(8)]
450450
pub fn check_is_ascii() {
451451
if kani::any() {
452-
// TODO: ARR_SIZE can be `std::usize::MAX` with cbmc argument
452+
// TODO: ARR_SIZE can be much larger with cbmc argument
453453
// `--arrays-uf-always`
454454
const ARR_SIZE: usize = 1000;
455455
let mut x: [u8; ARR_SIZE] = kani::any();

0 commit comments

Comments
 (0)