-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better proc-macro for Step enums #771
Conversation
const PRSS_EXCHANGE_STATE: u16 = 65531; | ||
const QUERY_TYPE_SEMIHONEST_STATE: u16 = 65533; | ||
const QUERY_TYPE_MALICIOUS_STATE: u16 = 65532; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still have these until we output real-world-infra
narrows to steps.txt
I wonder if making |
I think we can think of this one as the first iteration. I didn't want to add too many extra things, but I'll be happy to work on making it more flexible like |
BTW, I didn't use the |
chatted in TPAC about it - while I remain concerned about step macro being too powerful and general concern about proc-macros debuggability/readability/maintainability, I think we should push this change. We realized that I would also prefer to not use @taikiy is going to clean up some dead code and unless someone objects, push this change |
With this change,
#[step]
attribute macro expands to#[derive(Step)]
.Step
derive-macro will implement all necessary traits for both descriptive and compact gates. The new macro also adds two attributesobsolete
anddynamic
. You can annotate an enum variant asobsolete
to make the macro ignore it while macro expansion. For those steps that are dynamically executed (i.e., BitOpSteps), you can use#[dynamic]
attribute.Currently, we use
#[step]
attribute macro to annotate step enums, and it expands to#[derive(Step)]
derive macro. The reason for doing this indirection is that attribute macros allow enum-wide attribute like#[step(obsolete)]
. Without this, we'd need to annotate each variant instead.I've also made improvements to compile time errors to make them more actionable. Here are a few examples.
steps.txt