Skip to content

Foreign function blocks dropped #4313

Closed
@ayazhafiz

Description

@ayazhafiz

Describe the bug

rustfmt drops block associated with a foreign function

To Reproduce

Formatting

extern "C" {
    fn f() {
        fn g() {}
    }
}

gives

extern "C" {
    fn f();
}

Context: rust-lang/rust#74204

Expected behavior

The formatting makes the code semantically correct, but causes a loss of information. I think rustfmt should preserve the block, if it has access to it.

Meta

  • rustfmt version: 37ec56d
  • From where did you install rustfmt?: from source
  • How do you run rustfmt: binary from source

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions