Skip to content

#[rustfmt::skip] attribute incompatible with #[unsafe(naked)] #140623

Closed
@Amanieu

Description

@Amanieu

The following code fails to compile due to attribute checks on naked functions being too strict.

#[rustfmt::skip]
#[unsafe(naked)]
extern "C" fn naked() {
    core::arch::naked_asm!("");
}
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
 --> src/lib.rs:1:1
  |
1 | #[rustfmt::skip]
  | ^^^^^^^^^^^^^^^^ the `rustfmt::skip` attribute is incompatible with `#[unsafe(naked)]`
2 | #[unsafe(naked)]
  | ---------------- function marked with `#[unsafe(naked)]` here

For more information about this error, try `rustc --explain E0736`.
error: could not compile `playground` (lib) due to 1 previous error

cc @folkertdev

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-nakedArea: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzSC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions