Skip to content

Commit e5c5acd

Browse files
celinvaltedinski
authored andcommitted
Update installation guide to include rmc crate build (rust-lang#604)
Update documentation after adding rmc crate
1 parent 431fa24 commit e5c5acd

File tree

10 files changed

+26
-60
lines changed

10 files changed

+26
-60
lines changed

rmc-docs/src/dev-documentation.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
```
1313
([`--keep-stage` comes with caveats](https://rustc-dev-guide.rust-lang.org/building/suggested.html#incremental-builds-with---keep-stage). Know that it may cause spurious build failures.)
1414
```bash
15+
# Build rmc crate
16+
./scripts/setup/rmc_build_lib.sh
17+
```
18+
```bash
1519
# Full regression suite
1620
./scripts/rmc-regression.sh
1721
```

rmc-docs/src/install-guide.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ Perform one-time build configuration:
5454

5555
**NOTE: If you skip the above (`llvm.download-ci-llvm=true` specifically), builds may take a long time as all of LLVM would need to be built from scratch.**
5656

57-
Then build RMC:
57+
Then build RMC and its library:
5858

5959
```
6060
./x.py build -i --stage 1 library/std
61+
./scripts/setup/build_rmc_lib.sh
6162
```
6263

6364
Then, optionally, run the regression tests:

rmc-docs/src/tutorial-first-steps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The second command opens that report in your default browser (on mac, on linux d
7171
From this report, we can find the trace of the failure and filter through it to find the relevant line (at present time, an unfortunate amount of generated code is present in the trace):
7272

7373
```
74-
let x: u32 = __nondet();
74+
let x: u32 = rmc::nondet();
7575
x = 1023u
7676
```
7777

rmc-docs/src/tutorial-kinds-of-failure.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,26 @@ Having run `rmc --visualize` and clicked on one of the failures to see a trace,
101101

102102
To navigate this trace to find the information you need, we recommend searching for things you expect to be somewhere in the trace:
103103

104-
1. Search the document for `__nondet` or `variable_of_interest =` such as `size =`.
104+
1. Search the document for `rmc::nondet` or `variable_of_interest =` such as `size =`.
105105
We can use this to find out what example values lead to a problem.
106-
In this case, where we just have a couple of `__nondet` values in our proof harness, we can learn a lot just by seeing what these are.
106+
In this case, where we just have a couple of `rmc::nondet` values in our proof harness, we can learn a lot just by seeing what these are.
107107
In this trace we find (and the values you get may be different):
108108

109109
```
110110
Step 23: Function main, File tests/bounds-check.rs, Line 43
111-
let size: usize = __nondet();
111+
let size: usize = rmc::nondet();
112112
size = 0ul
113113
114114
Step 27: Function main, File tests/bounds-check.rs, Line 45
115-
let index: usize = __nondet();
115+
let index: usize = rmc::nondet();
116116
index = 0ul
117117
118118
Step 36: Function main, File tests/bounds-check.rs, Line 43
119-
let size: usize = __nondet();
119+
let size: usize = rmc::nondet();
120120
size = 2464ul
121121
122122
Step 39: Function main, File tests/bounds-check.rs, Line 45
123-
let index: usize = __nondet();
123+
let index: usize = rmc::nondet();
124124
index = 2463ul
125125
```
126126

rmc-docs/src/tutorial/kinds-of-failure/tests/bounds-check.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,13 @@ mod tests {
2929
// ANCHOR_END: proptest
3030
}
3131

32-
fn __nondet<T>() -> T {
33-
unimplemented!()
34-
}
35-
fn __VERIFIER_assume(cond: bool) {
36-
unimplemented!()
37-
}
38-
3932
// ANCHOR: rmc
4033
#[cfg(rmc)]
4134
#[no_mangle]
4235
fn main() {
43-
let size: usize = __nondet();
44-
__VERIFIER_assume(size < 4096);
45-
let index: usize = __nondet();
36+
let size: usize = rmc::nondet();
37+
rmc::assume(size < 4096);
38+
let index: usize = rmc::nondet();
4639
let array: Vec<u32> = vec![0; size];
4740
get_wrapped(index, &array);
4841
}

rmc-docs/src/tutorial/kinds-of-failure/tests/overflow-quicksort.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ fn find_midpoint(low: u32, high: u32) -> u32 {
77
}
88
// ANCHOR_END: code
99

10-
fn __nondet<T>() -> T {
11-
unimplemented!()
12-
}
13-
fn __VERIFIER_assume(cond: bool) {
14-
unimplemented!()
15-
}
16-
1710
// ANCHOR: rmc
1811
#[cfg(rmc)]
1912
#[no_mangle]
2013
fn main() {
21-
let a: u32 = __nondet();
22-
let b: u32 = __nondet();
14+
let a: u32 = rmc::nondet();
15+
let b: u32 = rmc::nondet();
2316
find_midpoint(a, b);
2417
}
2518
// ANCHOR_END: rmc

rmc-docs/src/tutorial/kinds-of-failure/tests/overflow.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,12 @@ mod tests {
2222
// ANCHOR_END: proptest
2323
}
2424

25-
fn __nondet<T>() -> T {
26-
unimplemented!()
27-
}
28-
fn __VERIFIER_assume(cond: bool) {
29-
unimplemented!()
30-
}
31-
3225
// ANCHOR: rmc
3326
#[cfg(rmc)]
3427
#[no_mangle]
3528
fn main() {
36-
let a: u32 = __nondet();
37-
let b: u32 = __nondet();
29+
let a: u32 = rmc::nondet();
30+
let b: u32 = rmc::nondet();
3831
simple_addition(a, b);
3932
}
4033
// ANCHOR_END: rmc

rmc-docs/src/tutorial/loops-unwinding/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,15 @@ fn initialize_prefix(length: usize, buffer: &mut [u8]) {
1414
}
1515
// ANCHOR_END: code
1616

17-
fn __nondet<T>() -> T {
18-
unimplemented!()
19-
}
20-
fn __VERIFIER_assume(cond: bool) {
21-
unimplemented!()
22-
}
23-
2417
// ANCHOR: rmc
2518
#[cfg(rmc)]
2619
#[no_mangle]
2720
fn main() {
2821
const LIMIT: usize = 10;
2922
let mut buffer: [u8; LIMIT] = [1; LIMIT];
3023

31-
let length = __nondet();
32-
__VERIFIER_assume(length <= LIMIT);
24+
let length = rmc::nondet();
25+
rmc::assume(length <= LIMIT);
3326

3427
initialize_prefix(length, &mut buffer);
3528
}

rmc-docs/src/tutorial/rmc-first-steps/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,11 @@ mod tests {
4646
// ANCHOR_END: proptest
4747
}
4848

49-
fn __nondet() -> u32 {
50-
unimplemented!()
51-
}
52-
5349
// ANCHOR: rmc
5450
#[cfg(rmc)]
5551
#[no_mangle]
5652
fn main() {
57-
let x: u32 = __nondet();
53+
let x: u32 = rmc::nondet();
5854
estimate_size(x);
5955
}
6056
// ANCHOR_END: rmc

rmc-docs/src/tutorial/rmc-first-steps/tests/final-form.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,12 @@ mod tests {
4848
// ANCHOR_END: proptest
4949
}
5050

51-
fn __nondet() -> u32 {
52-
unimplemented!()
53-
}
54-
fn __VERIFIER_assume(cond: bool) {
55-
unimplemented!()
56-
}
57-
5851
// ANCHOR: rmc
5952
#[cfg(rmc)]
6053
#[no_mangle]
6154
fn main() {
62-
let x: u32 = __nondet();
63-
__VERIFIER_assume(x < 4096);
55+
let x: u32 = rmc::nondet();
56+
rmc::assume(x < 4096);
6457
let y = estimate_size(x);
6558
assert!(y < 10);
6659
}
@@ -69,6 +62,6 @@ fn main() {
6962
#[cfg(rmc)]
7063
#[no_mangle]
7164
fn failing_main() {
72-
let x: u32 = __nondet();
65+
let x: u32 = rmc::nondet();
7366
let y = estimate_size(x);
7467
}

0 commit comments

Comments
 (0)