Skip to content

Contents of macro keeps getting indented every time rustfmt runs #2588

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

Closed
Amanieu opened this issue Apr 2, 2018 · 2 comments
Closed

Contents of macro keeps getting indented every time rustfmt runs #2588

Amanieu opened this issue Apr 2, 2018 · 2 comments
Labels
a-macros bug Panic, non-idempotency, invalid code, etc.

Comments

@Amanieu
Copy link
Member

Amanieu commented Apr 2, 2018

Possibly related to #1917?

Original:

macro_rules! m {
    () => {
        r#"
            test
        "#
    };
}

After 1 rustfmt:

macro_rules! m {
    () => {
        r#"
                    test
                "#
    };
}

After 2 rustfmt:

macro_rules! m {
    () => {
        r#"
                            test
                        "#
    };
}
@topecongiro topecongiro added bug Panic, non-idempotency, invalid code, etc. a-macros labels Apr 2, 2018
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Apr 2, 2018
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Apr 2, 2018
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Apr 2, 2018
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Apr 5, 2018
topecongiro added a commit to topecongiro/rustfmt that referenced this issue Apr 5, 2018
@nrc nrc closed this as completed in #2589 Apr 5, 2018
@Amanieu
Copy link
Member Author

Amanieu commented Apr 17, 2018

This bug is still present.

Before:

macro_rules! read_sysreg {
   ($name:ident, $reg:expr, $result:expr) => {
       safe_asm!(
           concat!("mrs $1, ", stringify!($reg)),
           : "=r" ($result)
           :
       )
   };
}

After:

macro_rules! read_sysreg {
    ($name:ident, $reg:expr, $result:expr) => {
        safe_asm!(
                    concat!("mrs $1, ", stringify!($reg)),
                    : "=r" ($result)
                    :
                )
    };
}

@topecongiro
Copy link
Contributor

@Amanieu Thanks for the additional report. This looks like a dup of #2607, would you please try this workaround for now?

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.
Projects
None yet
Development

No branches or pull requests

2 participants