Crate prusti_contracts

source ·

Macros

  • A macro for writing a loop body invariant.
  • A macro to annotate body variant of a loop to prove termination
  • A macro for defining a closure with a specification. Note: this is a declarative macro defined in this crate because declarative macros can’t be exported from the prusti-contracts-proc-macros proc-macro crate. See https://github.com/rust-lang/rust/issues/40090.
  • A macro for defining ghost blocks which will be left in for verification but omitted during compilation.
  • A macro for defining a predicate using prusti expression syntax instead of just Rust expressions.
  • A macro for writing assertions using the full prusti specifications
  • A macro for writing assumptions using prusti syntax
  • A macro for writing refutations using prusti syntax

Structs

  • a mathematical (unbounded) integer type it should not be constructed from running rust code, hence the private unit inside
  • A map type
  • A sequence type

Functions

  • This function is used to evaluate an expression in the context just before the borrows expires.
  • Existential quantifier.
  • Universal quantifier.
  • This function is used to evaluate an expression in the “old” context, that is at the beginning of the method call.
  • Creates an owned copy of a reference. This should only be used from within ghost code, as it circumvents the borrow checker.
  • Snapshot, “logical”, or “mathematical” equality. Compares the in-memory representation of two instances of the same type, even if there is no PartialEq nor Copy implementation. The in-memory representation is constructed recursively: references are followed, unsafe pointers and cells are not. Importantly, addresses are not taken into consideration.

Attribute Macros

  • A macro for writing a pledge on a function.
  • A macro for writing a two-state pledge on a function.
  • A macro for writing a postcondition on a function.
  • A macro for specifying external functions.
  • A macro for type invariants.
  • Macro for creating type models.
  • A macro to customize how a struct or enum should be printed in a counterexample
  • A macro for marking a function as pure.
  • A macro to add trait bounds on a generic type parameter and specifications which are active only when these bounds are satisfied for a call.
  • A macro for impl blocks that refine trait specifications.
  • A macro for writing a precondition on a function.
  • A macro to annotate termination of a function
  • A macro for marking a function as trusted.
  • A macro for marking a function as opted into verification.