Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightly revise the rest of the documentation #1396

Merged
merged 12 commits into from
Jul 23, 2022

Conversation

tedinski
Copy link
Contributor

@tedinski tedinski commented Jul 20, 2022

Description of changes:

This is a smattering of revisions to the Kani docs. Most prominently, it collapses "Usage" down to one page instead of having two, and I expand on using cfg a bit there.

Resolved issues:

Resolves #1320

Resolves #1390

This completes the last remaining task in that issue.

Call-outs:

Testing:

  • How is this change tested?

  • Is this a refactor change?

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@tedinski tedinski requested a review from a team as a code owner July 20, 2022 20:19
docs/src/usage.md Outdated Show resolved Hide resolved

## Usage on a single crate

For small examples or initial learning, it's very common to run Kani on just one source file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or crates that don't have external dependencies.


This will ensure that a normal build of your code will be completely unaffected by anything Kani-related.

Unfortunately, this is still required for code under `tests/` as this code might be built by `cargo test` normally and would still be unaware of the `kani` crate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what you are trying to say here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've revised this paragraph.

I'm getting at "the kani crate isn't yet published in crates.io, so you can't add it as a dev-dependency" without actually saying that. Just mentioning the implications of it.

When Kani builds your code, it does two important things:

1. It sets `cfg(kani)`.
2. It injects the `kani` crate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice if we start at least publishing the crate doc so we can reference here


Run `cargo kani --help` to see a complete list of arguments.

## Usage on a single crate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this should be at the top. It is easier to explain. It should at least come before the common options part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's deliberate. Almost everyone is going to use cargo kani, so that's what I'm talking about first. It's what most customers will care about.

docs/src/build-from-source.md Show resolved Hide resolved
docs/src/build-from-source.md Show resolved Hide resolved
docs/src/tutorial-real-code.md Outdated Show resolved Hide resolved
docs/src/tutorial-real-code.md Show resolved Hide resolved
docs/src/usage.md Outdated Show resolved Hide resolved
docs/src/usage.md Outdated Show resolved Hide resolved
docs/src/usage.md Show resolved Hide resolved
docs/src/usage.md Outdated Show resolved Hide resolved

This conditional compilation with `cfg(kani)` is still required for code under `tests/`.
(Unlike normal test code, which can unconditinoally make use `dev-depenencies` under `tests/`.)
When this code is built by `cargo test`, the `kani` crate is not available, and so it would otherwise cause build failures.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a snippet of an example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the code above it an example? I'm not sure what else?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant an example of when [kani::proof] is used under tests/ to clarify why cfg(kani) is needed to not break cargo test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure what you mean. But I realized my phrasing was probably still confusing, so I made another revision.

However, if you plan to integrate Kani in your projects, the recommended
approach is to use [Kani on a package](./cargo-kani.md) because of its ability
to handle external dependencies.
If you plan to integrate Kani in your projects, the recommended approach is to use `cargo kani`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add this sentence back:

This is due to its ability to handle external dependencies and the option add configurations via the Cargo.toml file.

@tedinski tedinski merged commit a06136b into model-checking:main Jul 23, 2022
@tedinski tedinski deleted the docs-5 branch July 23, 2022 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants