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

rustfmt is removing a static variable when max_width is set #1914

Closed
fitzgen opened this issue Aug 24, 2017 · 2 comments
Closed

rustfmt is removing a static variable when max_width is set #1914

fitzgen opened this issue Aug 24, 2017 · 2 comments
Labels
bug Panic, non-idempotency, invalid code, etc. only-with-option requires a non-default option value to reproduce p-high

Comments

@fitzgen
Copy link
Member

fitzgen commented Aug 24, 2017

Given this file:

input.rs:

extern "C" {
    #[link_name = "_ZN7MyClass26example_check_no_collisionE"]
 pub static mut  MyClass_example_check_no_collision  :  * const :: std :: os :: raw :: c_int ;
}

Running the most recently published rustfmt on it:

$ rustup run nightly rustfmt < input.rs > output.rs

Results in this file:

output.rs:

extern "C" {
    #[link_name = "_ZN7MyClass26example_check_no_collisionE"]
    ;
}

Note that the pub static mut MyClass_example_check_no_collision variable has disappeared and there is only a semicolon in its place.

The above only happens if I am running rustfmt inside a directory with the following rustfmt.toml:

max_width = 80

$ rustup run nightly rustfmt --version
0.2.2-nightly ( )
$ rustup run nightly rustc --version
rustc 1.21.0-nightly (469a6f9bd 2017-08-22)
@topecongiro topecongiro added bug Panic, non-idempotency, invalid code, etc. p-high only-with-option requires a non-default option value to reproduce labels Aug 24, 2017
@topecongiro
Copy link
Contributor

I could not reproduce this with the latest master(0.2.2-nightly (1a02c35 2017-08-25)). It still exceeds max width, though.

@topecongiro
Copy link
Contributor

My bad, I could.

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. only-with-option requires a non-default option value to reproduce p-high
Projects
None yet
Development

No branches or pull requests

2 participants