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

Macro within macro not idempotent #5045

Closed
Ten0 opened this issue Oct 27, 2021 · 1 comment
Closed

Macro within macro not idempotent #5045

Ten0 opened this issue Oct 27, 2021 · 1 comment

Comments

@Ten0
Copy link

Ten0 commented Oct 27, 2021

Not sure if "macro within macro" is the actual issue, but here's the example:

macro_rules! make_macro {
    ($d: tt $x: ident) => {
        macro_rules! make_x {
            ($d b: ident) => {
                pub struct $x{
                    pub $d b : (),
                }
            };
        }
    };
}

make_macro!($ Foo);

mod bar {
    make_x! {x}
}

fn main() {
    let _ = bar::Foo { x: () };
}

Rustfmt adds 2 indents on lines [4, 9] every time it's run.

@calebcartwright
Copy link
Member

Believe this is a duplicate of #4609?

@Ten0 Ten0 closed this as completed Oct 30, 2021
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