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

Switch transmute_ptr_to_ptr to "pedantic" class. #7102

Merged
merged 1 commit into from
Apr 22, 2021
Merged

Switch transmute_ptr_to_ptr to "pedantic" class. #7102

merged 1 commit into from
Apr 22, 2021

Conversation

taralx
Copy link
Contributor

@taralx taralx commented Apr 16, 2021

Per discussion in #6372, this lint has significant false positives.

changelog: transmute_ptr_to_ptr defaults to "allow".

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 16, 2021
Per discussion in #6372, this lint has significant false positives.
@flip1995
Copy link
Member

Moving this lint to pedantic only treats the symptoms, not the cause.

@oli-obk wrote in the issue discussing this lint first:

You can do &*(&some_u32 as *const u32 as *const f32) which conveys the horror of it much better than transmute(&some_u32)

I don't think Clippy should suggest more complicated code which should then implicitly suggest to the programmer that what they're doing may be wrong. Either we say that this is just wrong (which it isn't in all cases) or we remove the lint completely. Or better explain why this lint exists.

@oli-obk in #2418 (comment)

We should [...] create a lint for transmuting references to references, because one should be using raw ptr casts in that case.

Why is that?

@taralx
Copy link
Contributor Author

taralx commented Apr 20, 2021

The description on pedantic is that it is for lints that may be incorrect in some cases. That seems to match your complaint above. Have I misunderstood the nature of this category?

@oli-obk
Copy link
Contributor

oli-obk commented Apr 22, 2021

Yea, my opinions have changed since I wrote that. Pedantic sounds right

@flip1995
Copy link
Member

Ok, SGTM.

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Apr 22, 2021

📌 Commit 8b5faf4 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Apr 22, 2021

⌛ Testing commit 8b5faf4 with merge 1f7aef3...

@bors
Copy link
Contributor

bors commented Apr 22, 2021

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 1f7aef3 to master...

@bors bors merged commit 1f7aef3 into rust-lang:master Apr 22, 2021
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.

5 participants