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

Make non-verus-macro items external by default #771

Merged
merged 6 commits into from
Nov 7, 2023

Conversation

Chris-Hawblitzel
Copy link
Collaborator

When --external-by-default is passed on the command line, treat items outside the verus! macro as #[verifier::external] unless marked #[verifier::verify]. This makes it easier to verify small amounts of code inside a larger unverified Rust crate. I would expect uses of #[verifier::verify] to be rare for now; it would be more common to wrap the verified code inside verus!.

@tjhance
Copy link
Collaborator

tjhance commented Aug 29, 2023

Could we make it a crate setting (or even, a module setting) instead of a command line flag? e.g., with a crate attribute

#![verifier::verify_all]

I feel like that would be more appropriate for multi-crate projects where you might be combining verified and unverified crates.

@utaal
Copy link
Collaborator

utaal commented Aug 29, 2023

I would also prefer making it a crate-level attribute, rather than a command line flag. This is also because I'd like to avoid having too many flags that significantly change the behavior of the tool (and that one needs to remember to include in the command line when working with a specific project). In fact, I think this is an argument for making --arch-word-bits a crate-level flag too (which need not be part of this PR, obviously).

@Chris-Hawblitzel
Copy link
Collaborator Author

I updated the PR to make external-by-default the default behavior, with a --no-external-by-default option for backwards compatibility to get the old behavior. In the long run, I wouldn't expect people to use --no-external-by-default, although it may be used internally in our tests.

@Chris-Hawblitzel Chris-Hawblitzel changed the title Add --external-by-default flag Make non-verus-macro items external by default Nov 7, 2023
@Chris-Hawblitzel Chris-Hawblitzel merged commit 578f109 into main Nov 7, 2023
4 checks passed
@Chris-Hawblitzel Chris-Hawblitzel deleted the external-by-default branch November 7, 2023 17:33
utaal added a commit that referenced this pull request Nov 7, 2023
utaal pushed a commit that referenced this pull request Nov 7, 2023
* Add --external-by-default flag

* Make external-by-default opt-out rather than opt-in

* Put cfg_attr around verus::internal in atomic.rs
utaal added a commit that referenced this pull request Nov 7, 2023
Make non-verus-macro items external by default (#771)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants