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 removes values from extern static items #6267

Open
daxpedda opened this issue Aug 4, 2024 · 0 comments · May be fixed by #6268
Open

Rustfmt removes values from extern static items #6267

daxpedda opened this issue Aug 4, 2024 · 0 comments · May be fixed by #6268
Assignees

Comments

@daxpedda
Copy link
Contributor

daxpedda commented Aug 4, 2024

Rust v1.80 (rustfmt 1.7.0-stable (0514789 2024-07-21)) and Nightly (rustfmt 1.7.1-nightly (64ebd39 2024-08-03)) both remove values from static items:

extern "C" {
    static TEST: i32 = 42;
}

When formatted it gets transformed into:

extern "C" {
    static TEST: i32;
}

Rustfmt showed no error.
This code doesn't actually build in the first place, I'm using it with a proc-macro to implement externalized strings in wasm-bindgen (rustwasm/wasm-bindgen#4031) which allows this to work.

This is similar to #4159.

@daxpedda daxpedda changed the title Rustfmt removes extern static items with values Rustfmt removes values from extern static items Aug 4, 2024
@ytmimi ytmimi self-assigned this Aug 4, 2024
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

Successfully merging a pull request may close this issue.

2 participants