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

Can cargo-expand only expand procedural-macro, not including declarative macros? #167

Closed
StevenJiang1110 opened this issue Oct 14, 2022 · 1 comment

Comments

@StevenJiang1110
Copy link

I want to define and export declarative macros inside procedural-macro. For debug use, I want to see the exact declarative macros. Below is a simple example.

#[proc_macro]
pub fn example_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    quote!(
        #[macro_export]
        macro_rules! print_hello {
            () => (
                println!("hello world");
            )
        }
    ).into()
}

I only want to expand example_macro, but not print_hello inside, is this possible? Thanks a lot.

@dtolnay
Copy link
Owner

dtolnay commented Mar 24, 2023

It isn't. I would prefer not to support this in this crate, but anyone else would be free to implement it in a different tool!

@dtolnay dtolnay closed this as completed Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants