Skip to content

Commit e9a3227

Browse files
committed
Add a tour of the RawVec proof
Also: - Bumps VeriFast to 25.08 - Polishes the RawVec proof - Links to the VeriFast proofs from verifast-proofs/README.md
1 parent 8de7d8f commit e9a3227

File tree

7 files changed

+2075
-452
lines changed

7 files changed

+2075
-452
lines changed

.github/workflows/verifast-negative.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ jobs:
3030
- name: Install VeriFast
3131
run: |
3232
cd ~
33-
curl -OL https://github.com/verifast/verifast/releases/download/25.07/verifast-25.07-linux.tar.gz
34-
# https://github.com/verifast/verifast/attestations/8998468
35-
echo '48d2c53b4a6e4ba6bf03bd6303dbd92a02bfb896253c06266b29739c78bad23b verifast-25.07-linux.tar.gz' | shasum -a 256 -c
36-
tar xf verifast-25.07-linux.tar.gz
33+
curl -OL https://github.com/verifast/verifast/releases/download/25.08/verifast-25.08-linux.tar.gz
34+
# https://github.com/verifast/verifast/attestations/10123891
35+
echo '1e40019d6add91bf72141c86f4007f2fe1eef67f453cb7fb8f1f5ab7d31d509f verifast-25.08-linux.tar.gz' | shasum -a 256 -c
36+
tar xf verifast-25.08-linux.tar.gz
3737
3838
- name: Install the Rust toolchain used by VeriFast
3939
run: rustup toolchain install nightly-2025-04-09
4040

4141
- name: Run VeriFast Verification
4242
run: |
43-
export PATH=~/verifast-25.07/bin:$PATH
43+
export PATH=~/verifast-25.08/bin:$PATH
4444
cd verifast-proofs
4545
bash check-verifast-proofs-negative.sh

.github/workflows/verifast.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ jobs:
2727
- name: Install VeriFast
2828
run: |
2929
cd ~
30-
curl -OL https://github.com/verifast/verifast/releases/download/25.07/verifast-25.07-linux.tar.gz
31-
# https://github.com/verifast/verifast/attestations/8998468
32-
echo '48d2c53b4a6e4ba6bf03bd6303dbd92a02bfb896253c06266b29739c78bad23b verifast-25.07-linux.tar.gz' | shasum -a 256 -c
33-
tar xf verifast-25.07-linux.tar.gz
30+
curl -OL https://github.com/verifast/verifast/releases/download/25.08/verifast-25.08-linux.tar.gz
31+
# https://github.com/verifast/verifast/attestations/10123891
32+
echo '1e40019d6add91bf72141c86f4007f2fe1eef67f453cb7fb8f1f5ab7d31d509f verifast-25.08-linux.tar.gz' | shasum -a 256 -c
33+
tar xf verifast-25.08-linux.tar.gz
3434
3535
- name: Install the Rust toolchain used by VeriFast
3636
run: rustup toolchain install nightly-2025-04-09
3737

3838
- name: Run VeriFast Verification
3939
run: |
40-
export PATH=~/verifast-25.07/bin:$PATH
40+
export PATH=~/verifast-25.08/bin:$PATH
4141
cd verifast-proofs
4242
bash check-verifast-proofs.sh
4343

verifast-proofs/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,18 @@
22

33
This directory contains [VeriFast](../doc/src/tools/verifast.md) proofs for (currently a very, very small) part of the standard library.
44

5-
> [!NOTE]
6-
> TL;DR: If the VeriFast CI action fails because of a failing diff, please run `verifast-proofs/patch-verifast-proofs.sh` to fix the problem.
5+
Specifically, it currently contains the following proofs:
6+
7+
- Partial proof of [LinkedList](alloc/collections/linked_list.rs/)
8+
- Partial proof of [RawVec](alloc/raw_vec/mod.rs/)
9+
10+
See each proof's accompanying README for a tour of the proof and applicable caveats.
11+
12+
## Maintaining the proofs
13+
14+
If the VeriFast CI action fails because of a failing diff, please run `cd verifast-proofs; ./patch-verifast-proofs.sh` to fix the problem.
15+
16+
## `-skip_specless_fns`
717

818
VeriFast supports selecting the code to verify on a function-by-function basis. By default, when given a `.rs` file VeriFast will try to verify [semantic well-typedness](https://verifast.github.io/verifast/rust-reference/non-unsafe-funcs.html) of all non-`unsafe` functions in that file (and in any submodules), and will require that the user provide specifications for all `unsafe` functions, which it will then verify against those specifications. However, when given the `-skip_specless_fns` command-line flag, VeriFast will skip all functions for which the user did not provide a specification.
919

verifast-proofs/alloc/collections/linked_list.rs/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ fn pop_front_node<'a>(&'a mut self) -> Option<Box<Node<T>, &'a A>>
382382
//@ open [?f]ref_initialized_::<A>(alloc_ref1)();
383383
let alloc_ref = &self.alloc;
384384

385-
r = match head {
385+
r = match head {
386386
None => {
387387
//@ close [f]ref_initialized_::<A>(alloc_ref)();
388388
//@ close_frac_borrow(f, ref_initialized_(alloc_ref));
@@ -572,13 +572,12 @@ closes it back up afterwards.
572572
First of all, this proof was performed with the following VeriFast command-line flags:
573573
- `-skip_specless_fns`: VeriFast ignores the functions that do not have a `req` or `ens` clause.
574574
- `-ignore_unwind_paths`: This proof ignores code that is reachable only when unwinding.
575-
- `-allow_assume`: This proof uses a number of `assume` ghost statements and `assume_correct` clauses. These must be carefully audited.
575+
- `-allow_assume`: This proof uses a number of `assume` ghost statements and `assume_correct` clauses. These must be carefully audited. Specifically, this proof uses `assume` statements to assume that the lifetime of the allocator used by the LinkedList value equals `'static`, i.e. this proof only applies if the global allocator or another allocator that lasts forever is used.
576576

577577
Secondly, since VeriFast uses the `rustc` frontend, which assumes a particular target architecture, VeriFast's results hold only for the used Rust toolchain's target architecture. When VeriFast reports "0 errors found" for a Rust program, it always reports the targeted architecture as well (e.g. `0 errors found (2149 statements verified) (target: x86_64-unknown-linux-gnu (LP64))`).
578578

579579
Thirdly, VeriFast has a number of [known unsoundnesses](https://github.com/verifast/verifast/issues?q=is%3Aissue+is%3Aopen+label%3Aunsoundness) (reasons why VeriFast might in some cases incorrectly accept a program), including the following:
580580
- VeriFast does not yet fully verify compliance with Rust's [pointer aliasing rules](https://doc.rust-lang.org/reference/behavior-considered-undefined.html).
581581
- VeriFast does not yet properly verify compliance of custom type interpretations with Rust's [variance](https://doc.rust-lang.org/reference/subtyping.html#variance) rules.
582-
- The current standard library specifications do not [prevent an allocated memory block from outliving its allocator](https://github.com/verifast/verifast/issues/829). This is sound only if the global allocator is used.
583582

584583
Fourthly, unlike foundational tools such as [RefinedRust](https://plv.mpi-sws.org/refinedrust/), VeriFast has not itself been verified, so there are undoubtedly also unknown unsoundnesses. Such unsoundnesses might exist in VeriFast's [symbolic execution engine](https://github.com/model-checking/verify-rust-std/issues/213#issuecomment-2531006855) [itself](https://github.com/model-checking/verify-rust-std/issues/213#issuecomment-2534922580) or in its [prelude](https://github.com/verifast/verifast/tree/master/bin/rust) (definitions and axioms automatically imported at the start of every verification run) or in the [specifications](https://github.com/verifast/verifast/blob/master/bin/rust/std/lib.rsspec) it uses for the Rust standard library functions called by the program being verified.

0 commit comments

Comments
 (0)