-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow construct_runtime to take cfg attributes for pallets #11818
Allow construct_runtime to take cfg attributes for pallets #11818
Conversation
wen |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
cc @sam0x17 |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
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.
This makes sense to me and is a very reasonable improvement. I found some missing end-of-file newlines on a few files that would be cool to fix but other than that this looks good--macro code is well structured.
frame/support/test/tests/construct_runtime_ui/unsupported_pallet_attr.rs
Outdated
Show resolved
Hide resolved
frame/support/test/tests/construct_runtime_ui/unsupported_meta_structure.rs
Outdated
Show resolved
Hide resolved
frame/support/test/tests/construct_runtime_ui/invalid_meta_literal.rs
Outdated
Show resolved
Hide resolved
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.
high level, non-expert macro review
bot merge |
…h#11818) * Allow construct_runtime to take cfg attributes for pallets * cargo fmt * Remove commented out code * Fixes * cargo fmt * Remove inaccurate comments * Fix typo * Properly reverse pallets * Fixes * cargo fmt * Add missing newlines
Fixes #10286.
This PR allows
#[cfg]
attributes to exist on top of pallet declarations in theconstruct_runtime!
macro, and it works exactly in the way that you would intuitively expect -- the pallet immediately following the attribute would exist in the runtime only if the feature gate as described by thecfg
attribute is enabled, otherwise it does not exist.