Skip to content

unsafe extern { safe fn } support #13777

Open
@Nemo157

Description

@Nemo157

Description

Declaring an external function as safe is a form of safety assertion, so it should be covered by undocumented_unsafe_blocks and require a // SAFETY: comment. (Or some kind of new group as that lint name is specific to blocks (containing #13316 too), but my expectation is that everyone enabling the existing lint actually wants the more general form).

I tried this code:

#![deny(clippy::undocumented_unsafe_blocks)]

unsafe extern "C" {
    pub safe fn foo();
}

I expected to see this happen: something like the error: unsafe block missing a safety comment message

Instead, this happened: no lint

Version

1.85.0-nightly (2024-12-03 c44b3d50fea96a3e0417)

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    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