frame: GenesisBuild::build allowed in no_std (#14107)

* frame: GenesisBuild::build allowed in no_std

i`GenesisBuild::build` function will be required for no_std in no native
runtime world.

`GenesisBuild::build` macro generated function allows to build the runtime
GenesisConfig assembled from all pallets' GenesisConfigs.

* fixes

* GenesisBuild::build avaiable in no-std

- #[cfg(feature = "std")] is not longer added to GenesisBuild implementation.

* system: hash69 available for no-std

* elections-phragmen: panic message fixed for no_std

* frame::suport: doc updated

* test-runtime: default for GenesisConfig

* frame::test-pallet: serde/std added to std feature deps

* Cargo.toml: deps sorted

* Cargo.lock update

cargo update -p frame-support-test-pallet -p frame-support-test

* frame ui tests: cleanup

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2023-05-25 23:49:25 +02:00
committed by GitHub
parent 2aa863f667
commit e31a214a85
12 changed files with 20 additions and 158 deletions
@@ -19,7 +19,6 @@ use crate::pallet::Def;
///
/// * implement the trait `sp_runtime::BuildModuleGenesisStorage`
/// * add #[cfg(feature = "std")] to GenesisBuild implementation.
pub fn expand_genesis_build(def: &mut Def) -> proc_macro2::TokenStream {
let genesis_config = if let Some(genesis_config) = &def.genesis_config {
genesis_config
@@ -41,16 +40,6 @@ pub fn expand_genesis_build(def: &mut Def) -> proc_macro2::TokenStream {
let gen_cfg_use_gen = genesis_config.gen_kind.type_use_gen(genesis_build.attr_span);
let genesis_build_item =
&mut def.item.content.as_mut().expect("Checked by def parser").1[genesis_build.index];
let genesis_build_item_impl = if let syn::Item::Impl(impl_) = genesis_build_item {
impl_
} else {
unreachable!("Checked by genesis_build parser")
};
genesis_build_item_impl.attrs.push(syn::parse_quote!( #[cfg(feature = "std")] ));
let where_clause = &genesis_build.where_clause;
quote::quote_spanned!(genesis_build.attr_span =>