This repository has been archived by the owner on May 4, 2024. It is now read-only.
[move-compiler] implement the #[verify_only]
attribute
#420
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.
As title suggests, this is an implementation of the
#[verify_only]
annotation that can be used in a way that is similar to
#[test_only]
.The semantics of
#[verify_only]
is the following:Any AST element (in both source of in the library definitions)
annotated with the
#[verify_only]
attribute will be removedafter parsing, unless the
verify
flag is set when invokingthe compiler.
#[verify_only]
has no interaction with unit-testing relatedattributes such as
#[test]
,#[test_only]
or#[abort]
,#[expect_failure]
etc. A function that is marked#[verify_only]
hasno knowledge of that a
#[test_only]
function might exist, unless bothverify
andtesting
flags are set when invoking the compiler.A large portion of this PR is in fact an refactoring of the
#[test_only]
implementation as both
#[test_only]
and#[verify_only]
involvesfiltering AST nodes. This common functionality is abstracted and placed
into the
move-compiler/parser/filter.rs
file, and in particular, as aFilterContext
trait which can be customized as needed.Motivation
#[verify_only]
has come up in several discussions related to prover improvements. This is an attempt to implement it and unblock other lines of work.Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
New test cases added