Skip to content

Rustfmt removes values from extern static items #6267

Open
@daxpedda

Description

@daxpedda

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions