Emit error when Config part is imported but without the std feature (#9225)

* Emit error when Config part is imported but without the std feature

* Add UI test for missing std feature on GenesisConfig

* Update frame/support/test/Cargo.toml

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Remove unused imports

* Unify all dummy party checker macros

* Fix

* Dispaly pallet_path::GenesisConfig instead of PalletConfig in error message

* Revert changes to construct_runtime_ui.rs

* Add additional parameter for dummy part checker macro

* Apply suggestions from code review

* fix master merge: update version

* update Cargo.lock

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
Keith Yeung
2021-07-16 07:07:19 -07:00
committed by GitHub
parent 1e8035a273
commit 3ce2bd3eec
9 changed files with 268 additions and 89 deletions
@@ -18,7 +18,7 @@
use crate::construct_runtime::Pallet;
use inflector::Inflector;
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use quote::{ToTokens, format_ident, quote};
use syn::Ident;
pub fn expand_outer_config(
@@ -35,6 +35,7 @@ pub fn expand_outer_config(
if let Some(pallet_entry) = decl.find_part("Config") {
let path = &decl.path;
let pallet_name = &decl.name;
let path_str = path.into_token_stream().to_string();
let config = format_ident!("{}Config", pallet_name);
let field_name = &Ident::new(
&pallet_name.to_string().to_snake_case(),
@@ -47,6 +48,8 @@ pub fn expand_outer_config(
build_storage_calls.extend(expand_config_build_storage_call(scrate, runtime, decl, &field_name));
query_genesis_config_part_macros.push(quote! {
#path::__substrate_genesis_config_check::is_genesis_config_defined!(#pallet_name);
#[cfg(feature = "std")]
#path::__substrate_genesis_config_check::is_std_enabled_for_genesis!(#pallet_name, #path_str);
});
}
}