-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REMOVE BEFORE MERGING: Add cargo-verus demo
Just to aid discussion and review.
- Loading branch information
Showing
14 changed files
with
1,147 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
source/cargo-verus-illustration/doubly-linked-xor-test-using-verus-sysroot/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "doubly-linked-xor-test-using-verus-sysroot" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
doubly-linked-xor = { path = "../doubly-linked-xor" } | ||
|
||
[package.metadata.verus] | ||
verify = true | ||
imports = ["doubly_linked_xor"] |
1 change: 1 addition & 0 deletions
1
source/cargo-verus-illustration/doubly-linked-xor-test-using-verus-sysroot/src
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../doubly-linked-xor/src/ |
14 changes: 14 additions & 0 deletions
14
source/cargo-verus-illustration/doubly-linked-xor-test/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "doubly-linked-xor-test" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
vstd = { path = "../../vstd" } | ||
builtin = { path = "../../builtin" } | ||
builtin_macros = { path = "../../builtin_macros" } | ||
doubly-linked-xor = { path = "../doubly-linked-xor", features = ["explicit-verus-deps"] } | ||
|
||
[package.metadata.verus] | ||
verify = true | ||
imports = ["doubly_linked_xor"] |
31 changes: 31 additions & 0 deletions
31
source/cargo-verus-illustration/doubly-linked-xor-test/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use vstd::{prelude::*, string::*}; | ||
|
||
use doubly_linked_xor::DListXor; | ||
|
||
verus! { | ||
|
||
#[verifier::external_body] | ||
fn print_result(msg: StrSlice<'static>, value: u32) { | ||
println!("{}: {value}", msg.into_rust_str()); | ||
} | ||
|
||
fn main() { | ||
let mut t = DListXor::<u32>::new(); | ||
t.push_back(2); | ||
t.push_back(3); | ||
t.push_front(1); // 1, 2, 3 | ||
print_result(new_strlit("pushed"), 2); | ||
print_result(new_strlit("pushed"), 3); | ||
print_result(new_strlit("pushed"), 1); | ||
let x = t.pop_back(); // 3 | ||
let y = t.pop_front(); // 1 | ||
let z = t.pop_front(); // 2 | ||
assert(x == 3); | ||
assert(y == 1); | ||
assert(z == 2); | ||
print_result(new_strlit("popped"), x); | ||
print_result(new_strlit("popped"), y); | ||
print_result(new_strlit("popped"), z); | ||
} | ||
|
||
} // verus! |
15 changes: 15 additions & 0 deletions
15
source/cargo-verus-illustration/doubly-linked-xor/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "doubly-linked-xor" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
vstd = { path = "../../vstd", optional = true } | ||
builtin = { path = "../../builtin", optional = true } | ||
builtin_macros = { path = "../../builtin_macros", optional = true } | ||
|
||
[features] | ||
explicit-verus-deps = ["vstd", "builtin", "builtin_macros"] | ||
|
||
[package.metadata.verus] | ||
verify = true |
Oops, something went wrong.