Skip to content

Lint: warn when mixing #[repr(C)] with Drop#24935

Merged
bors merged 2 commits into
rust-lang:masterfrom
pnkfelix:lint-repr-c-drop
Apr 30, 2015
Merged

Lint: warn when mixing #[repr(C)] with Drop#24935
bors merged 2 commits into
rust-lang:masterfrom
pnkfelix:lint-repr-c-drop

Conversation

@pnkfelix
Copy link
Copy Markdown
Contributor

Lint: warn when mixing #[repr(C)] with Drop

Fix #24585

@rust-highfive
Copy link
Copy Markdown
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

Comment thread src/librustc_lint/builtin.rs Outdated
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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. :)

@alexcrichton
Copy link
Copy Markdown
Member

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.)
@pnkfelix
Copy link
Copy Markdown
Contributor Author

@bors r=alexcrichton 2e23d81 rollup

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Apr 29, 2015
Lint: warn when mixing `#[repr(C)]` with Drop

Fix rust-lang#24585
@bors bors merged commit 2e23d81 into rust-lang:master Apr 30, 2015
@pnkfelix
Copy link
Copy Markdown
Contributor Author

triage: beta-nominated

@rust-highfive rust-highfive added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 30, 2015
@pnkfelix
Copy link
Copy Markdown
Contributor Author

accepted for backport to beta channel.

(this is special case for 1.0; post 1.0 a change like this might need stronger motivation...)

@pnkfelix pnkfelix added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Apr 30, 2015
@brson brson removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 30, 2015
@brson
Copy link
Copy Markdown
Contributor

brson commented Apr 30, 2015

Backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-accepted Accepted for backporting to the compiler in the beta channel.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Drop flag is a footgun for #[repr(C)]

6 participants