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

missing_safety_doc should catch unsafe impl #7732

Closed
sffc opened this issue Sep 28, 2021 · 2 comments · Fixed by #7734
Closed

missing_safety_doc should catch unsafe impl #7732

sffc opened this issue Sep 28, 2021 · 2 comments · Fixed by #7734
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@sffc
Copy link

sffc commented Sep 28, 2021

I tried this code:

struct ExampleStruct {}
unsafe trait ExampleUnsafeTrait {}

unsafe impl ExampleUnsafeTrait for ExampleStruct {}

I expected to see this happen: The missing_safety_doc should complain about the unsafe impl not having safety docs.

Instead, this happened: This code passes the clippy check.

Meta

Rust version (rustc -Vv):

rustc 1.56.0-beta.3 (deef86610 2021-09-17)
binary: rustc
commit-hash: deef866109022248b2506587b377c6b1c881d963
commit-date: 2021-09-17
host: x86_64-unknown-linux-gnu
release: 1.56.0-beta.3
LLVM version: 13.0.0

CC @Manishearth

@sffc sffc added the C-bug Category: Clippy is not doing the correct thing label Sep 28, 2021
@xFrednet xFrednet added the I-false-negative Issue: The lint should have been triggered on code, but wasn't label Sep 28, 2021
@Manishearth
Copy link
Member

Manishearth commented Sep 28, 2021

missing_safety_doc is about documenting safety invariants for library types in API docs, not for documenting unsafe code in comments. As such it's irrelevant when it comes to unsafe impls (or unsafe blocks). However, it should absolutely warn on unsafe trait so we can fix that.

@Manishearth
Copy link
Member

#7734

@bors bors closed this as completed in fb17671 Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants