-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
@thiolliere feel free to add any issues I forgot to link to in the bullets, I think that's all of them |
You print a warning if someone uses |
cc @gupnik cc @kianenigma |
note that we have 3 choices: Choice 1 (I did this): use pallet::config_preludes::*;
#[derive_impl(TestDefaultConfig as pallet::DefaultConfig)] Choice 2: use pallet::config_preludes;
#[derive_impl(config_preludes::TestDefaultConfig as pallet::DefaultConfig)] Choice 3: #[derive_impl(pallet::config_preludes::TestDefaultConfig as pallet::DefaultConfig)] The reason we can't just do: use pallet::config_preludes::TestDefaultConfig;
#[derive_impl(TestDefaultConfig as pallet::DefaultConfig)] is that the Conversely when we access by an explicit path, it can get it properly, as shown above |
Almost forgot, still need to add the |
should we introduce a |
My thinking is right where yours is -- might be useful to have And yes, sorry for the confusion, before there were two things that potentially needed this (the proc macros themselves, and the exports). Now thanks to your recursive stuff, it's just the latter. |
So right now The problem with doing this, though, is that then from the perspective of Now all of that said, let's pretend for a moment that we don't have to worry about names colliding with the item we are attaching #[export_tokens]
struct MyStruct {
field: usize,
} => mod MyStruct {
macro_rules! __export_tokens_tt_my_struct_0 {
// ...
}
} Then we would be able to do an import like The problem of course with this approach is the name collides with the original item, so it would only work with the So at the end of the day I agree that the best we can do right now until rust adds the ability to ask if a symbol is defined at the current compilation step is to write some sort of The problem with writing such a macro, though, is we will have to know the So it could be that we require specifying an ident like Yeah I think that is the solution. The unfortunate thing is I don't think there is a way to get an intelligent compile-error here pushing people towards adding an ident to their |
Now all of that said, I think it would be wise to merge as is and address this |
Co-authored-by: Guillaume Yu Thiolliere <[email protected]>
Given that we are iterating fast on |
Yeah my plan is to merge this as soon as https://github.com/paritytech/ci_cd/issues/816 / #14389 is in since I can't produce UI test output that the CI likes now without downgrading to the previous stable rust |
btw word is from the CI people we will have to skip Rust 1.70 because of some ICE issues, so have manually downgraded to 1.69 to get CI to pass and will merge like this |
bot merge |
* update to macro_magic 0.4.0 * remove deprecated syntax and related doc comments * upgrade to macro_magic v0.4.1 * fix import issue * fix UI tests * resolve frame_support path properly * add docs note about importing * fix typo * Update frame/support/procedural/src/lib.rs Co-authored-by: Guillaume Yu Thiolliere <[email protected]> * revert UI tests changes because we can't use rust 1.70 * fix UI tests * fix another UI test * use simplified import style * switch back import since tests are written expecting it that way --------- Co-authored-by: Guillaume Yu Thiolliere <[email protected]>
This brings in the new (breaking) changes from
macro_magic
0.4.0 (see https://github.com/sam0x17/macro_magic/releases/tag/v0.4.0 and sam0x17/macro_magic#3)I would say this release is noteworthy because anyone usingderive_impl
will now no longer need to use#[use_attr]
to import it, but happy to remove that label if we don't think this is worth mentioning.WIP while I get derive_impl working properly (have to make 1-2 more changes).Still WIP while I get the expr-based frame_support import workingready to merge once UI tests issue with CI is resolved