Skip to main content

Crate verus_builtin_macros

Crate verus_builtin_macros 

Source

Macros§

atomic_with_ghost_helper
calc_proc_macro
exec_spec_unverified
Automatically compiles spec items to exec items, but without proofs of functional correctness. This means that,iIn contrast to exec_spec_verified!, all specifications on compiled executable code generated by exec_spec_unverified! are trusted.
exec_spec_verified
Automatically compiles spec items to exec items, with proofs of functional correctness.
fndecl
proof
Add a verus proof block.
proof_decl
proof_decl add extra stmts that are used only for verification. For example, declare a ghost/tracked variable. To avoid confusion, let stmts without ghost/tracked is not supported. Non-local stmts inside proof_decl! are treated similar to those in proof!
proof_with
proof_with add ghost input/output to the next function call. In stable rust, we cannot add attribute-based macro to expr/statement. Using proof_with! to tell #verus_spec to add ghost input/output. Using proof_with outside of #verus_spec does not have any side effects.
struct_with_invariants
verus
verus_erase_ghost
verus_exec_expr
verus_exec_expr_erase_ghost
verus_exec_expr_keep_ghost
verus_exec_inv_macro_exprs
verus_exec_macro_exprs
verus_ghost_inv_macro_exprs
verus_impl
Like verus!, but for use inside a (non-trait) impl
verus_keep_ghost
verus_proof_expr
verus_proof_macro_explicit_exprs
verus_proof_macro_explicit_exprs!(f!(tts)) applies verus syntax to transform tts into tts', then returns f!(tts'), only applying the transform to any of the exprs within it that are explicitly prefixed with @@, leaving the rest as-is. Contrast this to verus_proof_macro_exprs which is likely what you want to try first to see if it satisfies your needs.
verus_proof_macro_exprs
verus_proof_macro_exprs!(f!(exprs)) applies verus syntax to transform exprs into exprs’, then returns f!(exprs’), where exprs is a sequence of expressions separated by “,”, “;”, and/or “=>”.
verus_trait_impl
Like verus!, but for use inside a trait impl

Attribute Macros§

auto_spec
This copies the body of an exec function into a “returns” clause, so that the exec function will be also usable as a spec function. For example, #[vstd::contrib::auto_spec] fn f(u: u8) -> u8 { u / 2 } becomes: #[verifier::allow_in_spec] fn f(u: u8) -> u8 returns (u / 2) { u / 2 } The macro performs some limited fixups, such as removing proof blocks and turning +, -, and * into add, sub, mul. However, only a few such fixups are currently implemented and not all exec bodies will be usable as return clauses, so this macro will not work on all exec functions.
is_variant
Add is_<VARIANT> and get_<VARIANT> functions to an enum
is_variant_no_deprecation_warning
Add is_<VARIANT> and get_<VARIANT> functions to an enum
verus_enum_synthesize
verus_spec
verus_verify

Derive Macros§

Structural
StructuralEq