Skip to content

Last letter in derive statement gets removed by rustfmt nightly #4610

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
cdbrkfxrpt opened this issue Dec 24, 2020 · 3 comments
Closed

Last letter in derive statement gets removed by rustfmt nightly #4610

cdbrkfxrpt opened this issue Dec 24, 2020 · 3 comments
Labels
bug Panic, non-idempotency, invalid code, etc. duplicate

Comments

@cdbrkfxrpt
Copy link

Describe the bug

On the nightly toolchain, rustfmt removes the last letter from any derive statement, i.e.

#[derive(Debug)]

becomes

#[derive(Debu)]

In my rustfmt.toml, I have the following line:

# "Block" | "Visual"
indent_style = "Visual"

If I comment this line (or change it to "Block", which is the default) the issue goes away (but formatting happens completely differently, of course, so this is not a viable fix).

To Reproduce

Heads up: I'm only able to reproduce this on my laptop. It does not reproduce on my workstation. However I have no clue what the difference between the systems may be; they're both Debian sid on latest updates, both have Rust installed and updated via rustup, both have the exact same setup in terms of terminal emulator, shell, environment,etc.

To reproduce - if you can - simple throw the following into a file (let's call it test.rs):

#[derive(Debug)]
struct Foo {
  some:   usize,
  member: String,
}

Put the file in a directory together with a rustfmt.toml file containing:

# "Block" | "Visual"
indent_style = "Visual"

Finally, run rustfmt test.rs.

Expected behavior

I expect rustfmt not to remove letters from my code in this fashion.

Meta

  • rustfmt version: rustfmt 1.4.29-nightly (70ce182 2020-12-04)
  • From where did you install rustfmt?: rustup
  • How do you run rustfmt: normally via vim but this issue shows up regardless (i.e. I can reproduce using rustfmt or cargo fmt)
@cdbrkfxrpt cdbrkfxrpt added the bug Panic, non-idempotency, invalid code, etc. label Dec 24, 2020
@calebcartwright
Copy link
Member

Closing as duplicate of #4584, already fixed in the latest 1.4.30 version which I believe will be in the next published nightly (otherwise the following one)

@cdbrkfxrpt
Copy link
Author

i'm sorry, i actually searched "derive" in the issues but #4584 didn't pop up for some reason.

thanks for the info though.

@calebcartwright
Copy link
Member

No worries!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc. duplicate
Projects
None yet
Development

No branches or pull requests

2 participants