-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Unsafe lint will also check for unsafe functions, traits, and implementations #22542
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
Conversation
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
Looks great. Could you add a test for an impl Foo {
unsafe fn method(&self) {}
} |
Allow, | ||
"usage of an `unsafe` block" | ||
"usage of an `unsafe` code" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: drop the article an
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, totally missed that, thanks for the catch!
Checks include declaration/implementation of unsafe functions, traits, and methods. This allows warning or forbidding all uses of unsafe code, whereas previously only unsafe blocks were caught by the lint. The lint has been renamed from `unsafe-blocks` to `unsafe-code` to reflect its new purpose. This is a minor [breaking-change] Closes #22430
@huonw I added tests for (both declaring and implementing) unsafe methods of traits. My previous implementation of the lint didn't catch these, so I refactored the code to catch them as well! |
@bors r+ be0d Thanks! |
This allows warning or forbidding all uses of unsafe code, whereas previously only unsafe blocks were caught by the lint. The lint has been renamed from `unsafe-blocks` to `unsafe-code` to reflect its new purpose. This is a minor [breaking-change] Closes rust-lang#22430
Needs Manishearth@bf13792 to work. |
This allows warning or forbidding all uses of unsafe code, whereas previously only unsafe blocks were caught by the lint. The lint has been renamed from `unsafe-blocks` to `unsafe-code` to reflect its new purpose. This is a minor [breaking-change] Closes rust-lang#22430
Thank you for the fix @Manishearth! |
This allows warning or forbidding all uses of unsafe code, whereas
previously only unsafe blocks were caught by the lint.
The lint has been renamed from
unsafe-blocks
tounsafe-code
toreflect its new purpose.
This is a minor [breaking-change]
Closes #22430