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 threadsrc/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
ContributorAuthor

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
ContributorAuthor

@bors r=alexcrichton 2e23d81 rollup

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Apr 29, 2015
@bors
bors merged commit 2e23d81 into rust-lang:masterApr 30, 2015
@pnkfelix

Copy link
Copy Markdown
ContributorAuthor

triage: beta-nominated

@rust-highfiverust-highfive added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 30, 2015
@pnkfelix

Copy link
Copy Markdown
ContributorAuthor

accepted for backport to beta channel.

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

@pnkfelixpnkfelix added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Apr 30, 2015
@alexcrichtonalexcrichton mentioned this pull request Apr 30, 2015
@brsonbrson removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Apr 30, 2015
@brson

Copy link
Copy Markdown
Contributor

Backported.

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

Labels

beta-acceptedAccepted 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

@pnkfelix@rust-highfive@alexcrichton@brson@huonw@bors