Skip to content

Commit 9bd7cc2

Browse files
fix invariant
1 parent ce54852 commit 9bd7cc2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/slice/memchr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const fn memchr_aligned(x: u8, text: &[u8]) -> Option<usize> {
7979

8080
// search the body of the text
8181
let repeated_x = usize::repeat_u8(x);
82-
#[safety::loop_invariant(len >= 2 * USIZE_BYTES && )]
82+
#[safety::loop_invariant(len >= 2 * USIZE_BYTES && offset <= len)]
8383
while offset <= len - 2 * USIZE_BYTES {
8484
// SAFETY: the while's predicate guarantees a distance of at least 2 * usize_bytes
8585
// between the offset and the end of the slice.

0 commit comments

Comments
 (0)