Skip to content

Commit 52b2eea

Browse files
committed
[kani] Prove some PtrInner methods
Also add Kani `requires` and `ensures` annotations to some methods and to some functions in `util`. While we're here, roll Kani to 0.60.0 and fix the Kani roller. gherrit-pr-id: Ic1e352d3d92a45ff86d8ca85b8221bccfb07033b
1 parent f375ace commit 52b2eea

File tree

6 files changed

+388
-7
lines changed

6 files changed

+388
-7
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,10 +592,10 @@ jobs:
592592
# TODO(https://github.com/model-checking/kani-github-action/issues/56):
593593
# Go back to testing all features once the Kani GitHub Action supports
594594
# specifying a particular toolchain.
595-
args: "--package zerocopy --features __internal_use_only_features_that_work_on_stable --output-format=terse -Zfunction-contracts --randomize-layout --memory-safety-checks --overflow-checks --undefined-function-checks --unwinding-checks"
595+
args: "--package zerocopy --features __internal_use_only_features_that_work_on_stable --output-format=terse -Zfunction-contracts -Zmem-predicates --randomize-layout --memory-safety-checks --overflow-checks --undefined-function-checks --unwinding-checks"
596596
# This version is automatically rolled by
597597
# `roll-pinned-toolchain-versions.yml`.
598-
kani-version: 0.55.0
598+
kani-version: 0.60.0
599599

600600
# NEON intrinsics are currently broken on big-endian platforms. [1] This test ensures
601601
# that we don't accidentally attempt to compile these intrinsics on such platforms. We

.github/workflows/roll-pinned-toolchain-versions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144
runs-on: ubuntu-latest
145145
strategy:
146146
matrix:
147-
branch: ["main", "v0.7.x"]
147+
branch: ["main"]
148148
name: Roll pinned Kani version
149149
steps:
150150
- name: Checkout code

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ use std::io;
377377

378378
use crate::pointer::invariant::{self, BecauseExclusive};
379379

380-
#[cfg(any(feature = "alloc", test))]
380+
#[cfg(any(feature = "alloc", test, kani))]
381381
extern crate alloc;
382382
#[cfg(any(feature = "alloc", test))]
383383
use alloc::{boxed::Box, vec::Vec};
@@ -738,8 +738,13 @@ pub unsafe trait KnownLayout {
738738
/// The type of metadata stored in a pointer to `Self`.
739739
///
740740
/// This is `()` for sized types and `usize` for slice DSTs.
741+
#[cfg(not(kani))]
741742
type PointerMetadata: PointerMetadata;
742743

744+
#[cfg(kani)]
745+
#[allow(missing_docs)]
746+
type PointerMetadata: PointerMetadata + kani::Arbitrary;
747+
743748
/// A maybe-uninitialized analog of `Self`
744749
///
745750
/// # Safety

0 commit comments

Comments
 (0)