-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1415 from Aurel300/user-guide-rework
User guide rework
- Loading branch information
Showing
103 changed files
with
3,961 additions
and
2,524 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -31,3 +31,6 @@ log/ | |
nll-facts/ | ||
benchmark-output/ | ||
oprofile_data/ | ||
|
||
docs/user-guide/book/ | ||
docs/dev-guide/book/ |
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 |
---|---|---|
|
@@ -22,6 +22,9 @@ members = [ | |
"jni-gen", | ||
"jni-gen/systest", | ||
] | ||
exclude = [ | ||
"docs/dummy" | ||
] | ||
|
||
[profile.dev] | ||
debug = 1 | ||
|
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 |
---|---|---|
@@ -1,3 +1,50 @@ | ||
# Documentation | ||
|
||
This is the source directory for Prusti's GitHub page (<https://viperproject.github.io/prusti-dev/>). Modifications should consist of pushes or pull requests to the `master` branch. Deployment on the `gh-pages` branch is done automatically via GitHub actions. | ||
|
||
The books in this documentation use [mdbook](https://rust-lang.github.io/mdBook/index.html). | ||
|
||
## Showing the book locally | ||
|
||
After [installing mdbook](https://rust-lang.github.io/mdBook/guide/installation.html) and cloning the docs onto your machine, go to the book directory you want to work on. | ||
|
||
By running `mdbook serve --open` (`mdbook.exe` on Windows), mdbooks will build the book and open it in your default browser. | ||
On a file change, mdbook will rebuild the book and the browser window should refresh. | ||
|
||
|
||
## Importing code files into the book | ||
|
||
Small code samples can be immediately put into a code block inline to the book. | ||
Larger code samples and code that should be checked by Prusti for correctness should be put into the prusti testing directory (`../prusti-tests/tests/`). | ||
|
||
There you can put them in the corresponding directory, like is already done in `/verify/pass/user-guide/`. | ||
These files will be automatically tested by the Prusti test-suite. | ||
|
||
Code blocks that are not supposed to be run by a user, please add `noplaypen` to the code block. | ||
|
||
To test all code imported into the documentation (in this case the user guide tutorial), you can run this command: | ||
- `./x.py test -p prusti-tests --test compiletest -- user-guide` | ||
This will attempt to verify all the Prusti examples in the `prusti-tests` directory that have the string "user-guide" in their path. | ||
|
||
|
||
## Doctests | ||
|
||
The final book can be tested using `mdbook test` (see [here](https://rust-lang.github.io/mdBook/cli/test.html)). | ||
This will compile and run your code samples using **standard rustc** (no Prusti). | ||
|
||
Code blocks that are not intended to be compiled should be marked with `ignore`. | ||
Code blocks that should not run during doctests should be marked with `no_run`. | ||
|
||
See more on documentation tests [here](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html). | ||
|
||
Doctests should also run automatically as part of the Prusti CI. | ||
|
||
To run doctests locally with code that uses `prusti_contracts`, you will have to supply mdbook with a path containing the needed dependencies. | ||
One (not very nice way) to do this, is taking any Rust crate that uses `prusti_contracts`, building it, then passing the path to that crate to mdbook: `mdbook test -L "(Path_to_crate)/target/debug/deps/"` | ||
|
||
The crate `docs/dummy` is provided just to provide the dependencies. | ||
To run the doctests (in this case for the user guide): | ||
- `cd docs/dummy/` | ||
- `cargo build` | ||
- `cd ../user-guide/` | ||
- `mdbook test -L ../dummy/target/debug/deps/` |
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
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
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
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
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
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
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,2 @@ | ||
[registries.crates-io] | ||
protocol = "sparse" |
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,12 @@ | ||
[package] | ||
name = "dummy" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
# This crate is just used to provide the needed dependencies | ||
# for the mdbook documentation tests | ||
|
||
[dependencies] | ||
prusti-contracts = { path = "../../prusti-contracts/prusti-contracts/" } |
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 @@ | ||
This crate is only used to provide the needed dependencies for the mdbook documentation tests. |
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,8 @@ | ||
use prusti_contracts::*; | ||
|
||
// This crate is just used to provide the needed dependencies | ||
// for the mdbook documentation tests | ||
|
||
#[requires(true)] | ||
#[ensures(true)] | ||
fn _dummy() {} |
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
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
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
Oops, something went wrong.