Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

derive_impl doesn't seems to handle path correctly. Errors rise when using reexport #14287

Closed
2 tasks done
gui1117 opened this issue Jun 2, 2023 · 2 comments · Fixed by #14356
Closed
2 tasks done
Assignees
Labels
I4-annoyance The client behaves within expectations, however this “expected behaviour” itself is at issue. T1-runtime This PR/Issue is related to the topic “runtime”.

Comments

@gui1117
Copy link
Contributor

gui1117 commented Jun 2, 2023

Is there an existing issue?

  • I have searched the existing issues

Experiencing problems? Have you tried our Stack Exchange first?

  • This is not a support question.

Description of bug

When changing the path a little when invoking the derive_impl macro error arises.

derive_impl seems to require some item to be accessible from the first ident of the path of its first argument.

Steps to reproduce

1- change the frame-default-config-example a little by basically using a path with something in front of frame_system

diff --git a/frame/examples/default-config/src/lib.rs b/frame/examples/default-config/src/lib.rs
index adb2469e92f..4f236040796 100644
--- a/frame/examples/default-config/src/lib.rs
+++ b/frame/examples/default-config/src/lib.rs
@@ -130,7 +130,10 @@ pub mod tests {
                }
        );
 
-       #[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
+       pub mod bar {
+               pub use frame_system;
+       }
+       #[derive_impl(bar::frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
        impl frame_system::Config for Test {
                // these items are defined by frame-system as `no_default`, so we must specify them here.
                // Note that these are types that actually rely on the outer runtime, and can't sensibly

2- see the error:

error[E0433]: failed to resolve: could not find `__export_tokens_tt_test_default_config` in `bar`
   --> frame/examples/default-config/src/lib.rs:136:2
    |
136 |     #[derive_impl(bar::frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find `__export_tokens_tt_test_default_config` in `bar`
    |
    = note: this error originates in the macro `frame_support::macro_magic::forward_tokens` (in Nightly builds, run with -Z macro-backtrace for more info)
@bkchr
Copy link
Member

bkchr commented Jun 2, 2023

CC @sam0x17

@bkchr bkchr added the I4-annoyance The client behaves within expectations, however this “expected behaviour” itself is at issue. label Jun 2, 2023
@sam0x17
Copy link
Contributor

sam0x17 commented Jun 5, 2023

We (thanks to @thiolliere!) are working on a fix to macro_magic that will address this and a few other things. Thanks again !!!! 👍🏻

See here:

@juangirini juangirini added the T1-runtime This PR/Issue is related to the topic “runtime”. label Jun 7, 2023
@sam0x17 sam0x17 self-assigned this Jun 13, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Done in Runtime / FRAME Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I4-annoyance The client behaves within expectations, however this “expected behaviour” itself is at issue. T1-runtime This PR/Issue is related to the topic “runtime”.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants