-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Lint: warn when mixing #[repr(C)]
with Drop
#24935
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
codemap::DUMMY_SP); | ||
ctx.span_lint(DROP_WITH_REPR_EXTERN, | ||
drop_impl_span, | ||
"Structs with `#[repr(C)]` attribute that \ |
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.
I believe we generally start compiler messages with a lower case.
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.
I wonder if this message could also be rephrased slightly, maybe:
implementing
Drop
adds hidden state to a struct, possibly conflicting with the#[repr(C)]
attribute
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.
I didn't like the fact that I was referring solely to "structs" anyway, when this is slightly more general than that. So, that's fixed now. :)
Just a few minor nits, otherwise r=me though. Thanks @pnkfelix! |
THis includes tests for struct and enum. (I suspect the closure case is actually unreachable, but i see no harm in including it.)
30d29c9
to
2e23d81
Compare
Lint: warn when mixing `#[repr(C)]` with Drop Fix rust-lang#24585
triage: beta-nominated |
accepted for backport to beta channel. (this is special case for 1.0; post 1.0 a change like this might need stronger motivation...) |
Backported. |
Lint: warn when mixing
#[repr(C)]
with DropFix #24585