Skip to content

const unsafe fn is being reordered incorrectly #850

@Amanieu

Description

@Amanieu

rustfmt will turn this:

const unsafe fn x() {}

into this:

unsafe const fn x() {}

However the latter causes a compile error since const must come before unsafe. This causes rustfmt to break working code. Even running rustfmt twice results in an error since the second code is invalid syntax.

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