Skip to content

Commit 6f1e879

Browse files
committed
Remove proof without contracts for testing
1 parent ed059a1 commit 6f1e879

File tree

6 files changed

+16
-29
lines changed

6 files changed

+16
-29
lines changed

library/core/src/alloc/layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ mod verify {
655655
}
656656

657657
// pub const fn size(&self) -> usize
658-
#[kani::proof]
658+
//#[kani::proof]
659659
pub fn check_size() {
660660
let s = kani::any::<usize>();
661661
let a = kani::any::<usize>();
@@ -667,7 +667,7 @@ mod verify {
667667
}
668668

669669
// pub const fn align(&self) -> usize
670-
#[kani::proof]
670+
//#[kani::proof]
671671
pub fn check_align() {
672672
let layout = kani::any::<Layout>();
673673
assert!(layout.align().is_power_of_two());

library/core/src/lib.rs

Lines changed: 1 addition & 1 deletion
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+
#![cfg_attr(kani, feature(proc_macro_hygiene))]
233234
// tidy-alphabetical-end
234235
//
235236
// Target features:
@@ -247,7 +248,6 @@
247248
#![feature(tbm_target_feature)]
248249
#![feature(wasm_target_feature)]
249250
#![feature(x86_amx_intrinsics)]
250-
#![cfg_attr(kani, feature(proc_macro_hygiene))]
251251
// tidy-alphabetical-end
252252

253253
// allow using `core::` in intra-doc links

library/core/src/num/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ mod verify {
17701770
macro_rules! generate_carrying_mul_intervals {
17711771
($type:ty, $wide_type:ty, $($harness_name:ident, $min:expr, $max:expr),+) => {
17721772
$(
1773-
#[kani::proof]
1773+
//#[kani::proof]
17741774
pub fn $harness_name() {
17751775
let lhs: $type = kani::any::<$type>();
17761776
let rhs: $type = kani::any::<$type>();
@@ -1807,7 +1807,7 @@ mod verify {
18071807
macro_rules! generate_widening_mul_intervals {
18081808
($type:ty, $wide_type:ty, $($harness_name:ident, $min:expr, $max:expr),+) => {
18091809
$(
1810-
#[kani::proof]
1810+
//#[kani::proof]
18111811
pub fn $harness_name() {
18121812
let lhs: $type = kani::any::<$type>();
18131813
let rhs: $type = kani::any::<$type>();

library/core/src/ptr/unique.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ mod verify {
263263
}
264264

265265
// pub const unsafe fn as_ref(&self) -> &T
266-
#[kani::proof]
266+
//#[kani::proof]
267267
pub fn check_as_ref() {
268268
let mut x : i32 = kani::any();
269269
let xptr = &mut x;
@@ -274,7 +274,7 @@ mod verify {
274274
}
275275

276276
// pub const unsafe fn as_mut(&mut self) -> &mut T
277-
#[kani::proof]
277+
//#[kani::proof]
278278
pub fn check_as_mut() {
279279
let mut x : i32 = kani::any();
280280
let xptr = &mut x;
@@ -285,7 +285,7 @@ mod verify {
285285
}
286286

287287
// pub const fn cast<U>(self) -> Unique<U>
288-
#[kani::proof]
288+
//#[kani::proof]
289289
pub fn check_cast() {
290290
let mut x : i32 = kani::any();
291291
let xptr = &mut x;

library/core/src/str/pattern.rs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,10 +1959,10 @@ unsafe fn small_slice_eq(x: &[u8], y: &[u8]) -> bool {
19591959
unsafe {
19601960
let (mut px, mut py) = (x.as_ptr(), y.as_ptr());
19611961
let (pxend, pyend) = (px.add(x.len() - 4), py.add(y.len() - 4));
1962-
#[cfg_attr(kani, kani::loop_invariant(same_allocation(x.as_ptr(), px) && same_allocation(y.as_ptr(), py)
1962+
#[safety::loop_invariant(same_allocation(x.as_ptr(), px) && same_allocation(y.as_ptr(), py)
19631963
&& px as isize >= x.as_ptr() as isize
19641964
&& py as isize >= y.as_ptr() as isize
1965-
&& px as isize - x.as_ptr() as isize == (py as isize - y.as_ptr() as isize)))]
1965+
&& px as isize - x.as_ptr() as isize == (py as isize - y.as_ptr() as isize))]
19661966
while px < pxend {
19671967
let vx = (px as *const u32).read_unaligned();
19681968
let vy = (py as *const u32).read_unaligned();
@@ -1983,30 +1983,17 @@ unsafe fn small_slice_eq(x: &[u8], y: &[u8]) -> bool {
19831983
pub mod verify {
19841984
use super::*;
19851985

1986-
// Copied from https://github.com/model-checking/kani/blob/main/library/kani/src/slice.rs
1987-
// should be removed when these functions are moved to `kani_core`
1988-
pub fn any_slice_of_array<T, const LENGTH: usize>(arr: &[T; LENGTH]) -> &[T] {
1989-
let (from, to) = any_range::<LENGTH>();
1990-
&arr[from..to]
1991-
}
1992-
1993-
fn any_range<const LENGTH: usize>() -> (usize, usize) {
1994-
let from: usize = kani::any();
1995-
let to: usize = kani::any();
1996-
kani::assume(to <= LENGTH);
1997-
kani::assume(from <= to);
1998-
(from, to)
1999-
}
2000-
20011986
#[cfg(all(kani, target_arch = "x86_64"))] // only called on x86
20021987
#[kani::proof]
20031988
#[kani::unwind(4)]
20041989
pub fn check_small_slice_eq() {
1990+
// ARR_SIZE can `std::usize::MAX` with cbmc argument
1991+
// `--arrays-uf-always`
20051992
const ARR_SIZE: usize = 1000;
20061993
let x: [u8; ARR_SIZE] = kani::any();
20071994
let y: [u8; ARR_SIZE] = kani::any();
2008-
let xs = any_slice_of_array(&x);
2009-
let ys = any_slice_of_array(&y);
1995+
let xs = kani::slice::any_slice_of_array(&x);
1996+
let ys = kani::slice::any_slice_of_array(&y);
20101997
kani::assume(xs.len() == ys.len());
20111998
unsafe {
20121999
small_slice_eq(xs, ys);

library/core/src/unicode/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ mod verify {
3838
use crate::kani;
3939

4040
/// Checks that `to_upper` does not trigger UB or panics for all valid characters.
41-
#[kani::proof]
41+
//#[kani::proof]
4242
fn check_to_upper_safety() {
4343
let _ = to_upper(kani::any());
4444
}
4545

4646
/// Checks that `to_lower` does not trigger UB or panics for all valid characters.
47-
#[kani::proof]
47+
//#[kani::proof]
4848
fn check_to_lower_safety() {
4949
let _ = to_lower(kani::any());
5050
}

0 commit comments

Comments
 (0)