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

Drifting/unstable formatting when using a macro in an attribute inside a macro definition #5707

Closed
elomatreb opened this issue Mar 5, 2023 · 3 comments
Labels
a-macros bug Panic, non-idempotency, invalid code, etc. duplicate

Comments

@elomatreb
Copy link

The following snippet has weird/partially unstable formatting:

macro_rules! foo {
    () => {
        #[doc =
            concat!("hello world")
        ]
        pub struct Foo;
    };
}

(playground)

Formatting it once makes the contents of the doc attribute and its closing bracket drift right:

macro_rules! foo {
    () => {
        #[doc =
                    concat!("hello world")
                ]
        pub struct Foo;
    };
}

This happens again and again with every format until it hits the line length limit (I think):

macro_rules! foo {
    () => {
        #[doc =
                                                                        concat!("hello world")
                                                                    ]
        pub struct Foo;
    };
}

This does not happen outside of a macro_rules body or if the doc attribute does not contain another macro.

@ytmimi
Copy link
Contributor

ytmimi commented Mar 5, 2023

Thanks for reaching out. This is likely a duplicate of #5489, #5062

@ytmimi ytmimi added bug Panic, non-idempotency, invalid code, etc. duplicate a-macros labels Mar 5, 2023
@elomatreb
Copy link
Author

Right, that looks likely, didn't find those while searching.

Should I close this issue?

@ytmimi
Copy link
Contributor

ytmimi commented Mar 6, 2023

Yeah, let's close this.

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-macros bug Panic, non-idempotency, invalid code, etc. duplicate
Projects
None yet
Development

No branches or pull requests

2 participants