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

Fix transmute_undefined_repr with single field #[repr(C)] structs #8425

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Feb 13, 2022

Fixes: #8417

The description has also been made more precise.

changelog: Fix transmute_undefined_repr with single field #[repr(C)] structs
changelog: Move transmute_undefined_repr back to correctness

@rust-highfive
Copy link

r? @giraffate

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Feb 13, 2022
@giraffate
Copy link
Contributor

@bors r+

It looks good, thanks!

@bors
Copy link
Collaborator

bors commented Feb 14, 2022

📌 Commit 662df33 has been approved by giraffate

@bors
Copy link
Collaborator

bors commented Feb 14, 2022

⌛ Testing commit 662df33 with merge d718fd7...

bors added a commit that referenced this pull request Feb 14, 2022
Fix `transmute_undefined_repr` with single field `#[repr(C)]` structs

Fixes: #8417

The description has also been made more precise.

changelog: Fix `transmute_undefined_repr` with single field `#[repr(C)]` structs
changelog: Move `transmute_undefined_repr` back to `correctness`
@bors
Copy link
Collaborator

bors commented Feb 14, 2022

💥 Test timed out

@giraffate
Copy link
Contributor

@bors retry

@bors
Copy link
Collaborator

bors commented Feb 14, 2022

⌛ Testing commit 662df33 with merge 4931cab...

@bors
Copy link
Collaborator

bors commented Feb 14, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: giraffate
Pushing 4931cab to master...

@bors bors merged commit 4931cab into rust-lang:master Feb 14, 2022
bors added a commit that referenced this pull request Mar 2, 2022
…shearth

Transmute_undefined_repr to nursery again

This PR reinstates #8418, which was reverted in #8425 (incorrectly I think).

I don't want to start a revert war over this but I feel very strongly that this lint is not in a state that would be a net benefit to users of clippy. In its current form, making this an enabled-by-default `correctness` lint with authoritative-sounding proclamations of undefined behavior does more harm than the benefit of the true positive cases.

I can file a bunch more examples of false positives but I don't want to give the author of this lint the impression that it is ready to graduate from `nursery` as soon as I've exhausted the amount of time I am willing to spend revising this lint.

Instead I would recommend that the author of the lint try running it on some reputable codebases containing transmutes. Everywhere that the lint triggers please consider critically whether it should be triggering. For cases that you think are true positives, please raise a few of them with the crate authors (in a PR or issue) to better understand their perspective if they think the transmute is correct.

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: Re-remove [`transmute_undefined_repr`] from default set of enabled lints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

transmute_undefined_repr is wrong, transmute does not require a defined layout
4 participants