-
Notifications
You must be signed in to change notification settings - Fork 674
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
pallet macro: Support instantiable pallets in tasks #5194
pallet macro: Support instantiable pallets in tasks #5194
Conversation
pub fn expand_tasks(def: &mut Def) -> TokenStream2 { | ||
if let Some(tasks_def) = &def.tasks { | ||
if def.task_enum.is_none() { | ||
def.task_enum = Some(TaskEnumDef::generate( |
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.
In this PR we no longer modify the Def
to insert a generated task_enum
in case none were provided.
Instead we just expand what we need without modifying the Def
in the expand phase.
As a result we need to use tasks
instead of task_enum
for generating the automatic part later.
But all in all behavior is not changed
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.
LGTM but am not deep enough into the code.
More eyes on this 🙏 |
let ident = &self.item_enum.ident; | ||
let vis = &self.item_enum.vis; | ||
let attrs = &self.item_enum.attrs; | ||
let generics = &self.item_enum.generics; |
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.
These should be the same as type_use_generics
, if not we would have some problem. I think we should remove generics
and just use the type_use_generics
.
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.
I added a check for generics at eb3061c
Co-authored-by: Bastian Köcher <[email protected]>
Fix #5185
also implement handling of attr in expansion in construct-runtime