Stream: t-lang/meta

Topic: Clarification on #52234


view this post on Zulip Chase Wilson (Mar 11 2020 at 16:55):

@Vadim Petrochenkov I commented on the github issue but didn't want to clog it with discussion, I just don't understand how to actually bring what you said into practice. My setup is something like this:

macro_rules! generate_macro {
    () => {
        #[macro_export]
        macro_rules! new_macro { () => {}; }
    };
}

#[macro_export]
macro_rules! use_generated_macro {
    () => {
        $crate::new_macro!();
    };
}

So that triggers the macro_expanded_macro_exports_accessed_by_absolute_paths error, as it should. Problem is, I don't know how to work with/around that limitation

view this post on Zulip Vadim Petrochenkov (Mar 11 2020 at 18:41):

Problem is, I don't know how to work with/around that limitation

view this post on Zulip Vadim Petrochenkov (Mar 11 2020 at 18:42):

By referring to new_macro by a relative name.

view this post on Zulip Vadim Petrochenkov (Mar 11 2020 at 18:42):

In the same crate that defines it.

view this post on Zulip Vadim Petrochenkov (Mar 11 2020 at 18:43):

(For wg-meta this is probably an off-topic, this conversation can be moved to general, if possible.)

view this post on Zulip Vadim Petrochenkov (Mar 11 2020 at 18:46):

By referring to new_macro by a relative name in the same crate that defines it.

It may cause some ugliness, but that's the only way to avoid this limitation right now.


Last updated: Jan 26 2022 at 07:47 UTC