Skip to content
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

Fixes path issue in derive-impl #1823

Merged
merged 10 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions substrate/frame/examples/default-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ pub mod pallet {
// This will help use not need to disambiguate anything when using `derive_impl`.
use super::*;
use frame_support::derive_impl;
use frame_system::config_preludes::TestDefaultConfig as SystemTestDefaultConfig;

/// A type providing default configurations for this pallet in testing environment.
pub struct TestDefaultConfig;

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig, no_aggregated_types)]
#[derive_impl(SystemTestDefaultConfig as frame_system::DefaultConfig, no_aggregated_types)]
impl frame_system::DefaultConfig for TestDefaultConfig {}

#[frame_support::register_default_impl(TestDefaultConfig)]
Expand All @@ -109,7 +110,7 @@ pub mod pallet {
/// example, we simple derive `frame_system::config_preludes::TestDefaultConfig` again.
pub struct OtherDefaultConfig;

#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig, no_aggregated_types)]
#[derive_impl(SystemTestDefaultConfig as frame_system::DefaultConfig, no_aggregated_types)]
impl frame_system::DefaultConfig for OtherDefaultConfig {}

#[frame_support::register_default_impl(OtherDefaultConfig)]
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/support/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sp-weights = { path = "../../primitives/weights", default-features = false}
sp-debug-derive = { path = "../../primitives/debug-derive", default-features = false}
sp-metadata-ir = { path = "../../primitives/metadata-ir", default-features = false}
tt-call = "1.0.8"
macro_magic = "0.4.2"
macro_magic = { git = "https://github.com/gupnik/macro_magic", branch = "verbatim_export" }
gupnik marked this conversation as resolved.
Show resolved Hide resolved
frame-support-procedural = { path = "procedural", default-features = false}
paste = "1.0"
sp-state-machine = { path = "../../primitives/state-machine", default-features = false, optional = true}
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/support/procedural/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ quote = "1.0.28"
syn = { version = "2.0.38", features = ["full"] }
frame-support-procedural-tools = { path = "tools" }
proc-macro-warning = { version = "0.4.2", default-features = false }
macro_magic = { version = "0.4.2", features = ["proc_support"] }
macro_magic = { git = "https://github.com/gupnik/macro_magic", branch = "verbatim_export", features = ["proc_support"] }
expander = "2.0.0"
sp-core-hashing = { path = "../../../primitives/core/hashing" }

Expand Down
4 changes: 2 additions & 2 deletions substrate/frame/support/procedural/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ pub fn register_default_impl(attrs: TokenStream, tokens: TokenStream) -> TokenSt
let item_impl = syn::parse_macro_input!(tokens as ItemImpl);

// internally wrap macro_magic's `#[export_tokens]` macro
match macro_magic::mm_core::export_tokens_internal(attrs, item_impl.to_token_stream(), true) {
match macro_magic::mm_core::export_tokens_internal(attrs, item_impl.to_token_stream(), true, false) {
Ok(tokens) => tokens.into(),
Err(err) => err.to_compile_error().into(),
}
Expand Down Expand Up @@ -1565,7 +1565,7 @@ pub fn pallet_section(attr: TokenStream, tokens: TokenStream) -> TokenStream {
let _mod = parse_macro_input!(tokens_clone as ItemMod);

// use macro_magic's export_tokens as the internal implementation otherwise
match macro_magic::mm_core::export_tokens_internal(attr, tokens, false) {
match macro_magic::mm_core::export_tokens_internal(attr, tokens, false, true) {
Ok(tokens) => tokens.into(),
Err(err) => err.to_compile_error().into(),
}
Expand Down
Loading