pub proof fn create_open_invariant_credit() -> tracked c : OpenInvariantCreditExpand description
Create a new OpenInvariantCredit.
Verus enforces certain restrictions to ensure that the number of credits is always bounded in terms of the number of executable steps that have passed. This means a credit can be created in the middle of an executable function:
fn example() {
let tracked credit1 = create_open_invariant_credit();
let tracked credit2 = create_open_invariant_credit();
let tracked credit3 = create_open_invariant_credit();
}But not in a proof function:
proof fn example() {
let tracked credit = create_open_invariant_credit();
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// error: creating an invariant credit in potentially-unbounded ghost code
}