New attribute-based syntax for exec function specifications #1356
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This follows up the discussion in #1297 to replace the exec function requires/ensures attributes from #1297 with a single general-purpose attribute for exec function specifications that uses the familiar
verus!
syntax inside the exec function attribute. This pull request also tries to consolidate some code that was duplicated between theverus!
and attribute-based syntax implementations.Note that, as with #1297, this attribute-based syntax is an alternative to the
verus!
syntax for those who want such an alternative (see, for example, #1100 ). We do not intend to remove theverus!
syntax. In particular, spec functions and proof functions are still always written usingverus!
, while exec functions can use either syntax.The new function attribute syntax looks like:
See
example/syntax_attr.rs
for more complete examples.The new attribute name
verus_spec
avoids conflicts withverus_verify
, which can still be used independently for things likeverus_verify(external_body)
.The attribute syntax for loop invariants remains the same as in #1297 .