Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsafe extern { safe fn } support #13777

Open
Nemo157 opened this issue Dec 4, 2024 · 0 comments
Open

unsafe extern { safe fn } support #13777

Nemo157 opened this issue Dec 4, 2024 · 0 comments

Comments

@Nemo157
Copy link
Member

Nemo157 commented Dec 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant