mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Allow construct_runtime to take cfg attributes for pallets (#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
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
#[cfg(test)]
|
||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
error: `System` pallet declaration is feature gated, please remove any `#[cfg]` attributes
|
||||
--> tests/construct_runtime_ui/feature_gated_system_pallet.rs:10:3
|
||||
|
|
||||
10 | System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||
| ^^^^^^
|
||||
@@ -0,0 +1,15 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Pallet},
|
||||
#[cfg(feature = 1)]
|
||||
Balance: balances::{Config, Call},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,6 @@
|
||||
error: feature = 1
|
||||
^ expected one of `<key>`, `all`, `any`, `not` here
|
||||
--> tests/construct_runtime_ui/invalid_meta_literal.rs:10:3
|
||||
|
|
||||
10 | #[cfg(feature = 1)]
|
||||
| ^
|
||||
@@ -0,0 +1,15 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Pallet},
|
||||
#[cfg(feature(test))]
|
||||
Balance: balances::{Config, Call},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
error: feature(test)
|
||||
^ expected one of `=`, `,`, `)` here
|
||||
--> tests/construct_runtime_ui/unsupported_meta_structure.rs:10:3
|
||||
|
|
||||
10 | #[cfg(feature(test))]
|
||||
| ^
|
||||
@@ -0,0 +1,15 @@
|
||||
use frame_support::construct_runtime;
|
||||
|
||||
construct_runtime! {
|
||||
pub enum Runtime where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Pallet},
|
||||
#[attr]
|
||||
Balance: balances::{Config, Call},
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@@ -0,0 +1,5 @@
|
||||
error: Unsupported attribute, only #[cfg] is supported on pallet declarations in `construct_runtime`
|
||||
--> tests/construct_runtime_ui/unsupported_pallet_attr.rs:10:3
|
||||
|
|
||||
10 | #[attr]
|
||||
| ^
|
||||
@@ -626,6 +626,8 @@ frame_support::construct_runtime!(
|
||||
System: frame_system exclude_parts { Pallet, Storage },
|
||||
Example: pallet,
|
||||
Example2: pallet2 exclude_parts { Call },
|
||||
#[cfg(feature = "example3")]
|
||||
Example3: pallet3,
|
||||
Example4: pallet4 use_parts { Call },
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user