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

Erase ghost code by default #694

Closed
wants to merge 7 commits into from
Closed

Erase ghost code by default #694

wants to merge 7 commits into from

Conversation

hayley-leblanc
Copy link
Collaborator

@hayley-leblanc hayley-leblanc commented Jul 19, 2023

This PR makes the verus! macro's default behavior be to erase ghost code and requires a new configuration flag, verus_macro_keep_ghost, when ghost code should be kept for verification. verus_macro_keep_ghost replaces usage of the old flag verus_macro_erase_ghost.

With this PR, it is now possible to use cargo run or cargo build without any additional flags on a crate that uses the verus! macro to build or run an executable. There are some limitations and TODOs before this will work with anything beyond extremely basic Verus code -- most notably, since vstd is not a crate that can be used as a dependency, the crate being built can't use anything from vstd. I plan to look into this next.

I also plan to write up some documentation about how to use cargo to build/run Verus code; for now, the main things to know are:

  1. builtin_macros must be included as a dependency in the target crate's Cargo.toml file.
  2. Any imports that are only used for ghost code/by Verus and are not linked in as dependencies (e.g., builtin) should be marked with #[cfg(verus_macro_keep_ghost)].

@hayley-leblanc hayley-leblanc marked this pull request as draft July 19, 2023 23:25
@hayley-leblanc
Copy link
Collaborator Author

This PR now lets Verus code be run with rustc/cargo with no changes to source code at all and adds a Cargo.toml file to pervasive/ so that vstd can be built as a crate. The crate containing verified code should include builtin_macros, builtin, and vstd as local dependencies.

This PR depends on #709, so it will stay a draft at least until that is merged.

@hayley-leblanc
Copy link
Collaborator Author

Closing as these changes are subsumed by #733.

@utaal utaal deleted the cargo_build branch June 10, 2024 22:07
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.

2 participants