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

Don't lint cast_ptr_alignment when used for unaligned reads and writes #8632

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Apr 4, 2022

fixes #2881

Ideally this would trace the usage of the value rather than only looking at the parent expression, but that would require dataflow analysis. e.g.

let x = ptr as *const u16;
c.read_unaligned(x);

Arch specific intrinsic functions need to be checked for ones which could take an unaligned pointer. This can be another PR.

changelog: Don't lint cast_ptr_alignment when used for unaligned reads and writes

@rust-highfive
Copy link

r? @llogiq

(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 Apr 4, 2022
@llogiq
Copy link
Contributor

llogiq commented Apr 4, 2022

Thank you! Great as always, a joy to review.

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 4, 2022

📌 Commit e4fc15e has been approved by llogiq

@bors
Copy link
Collaborator

bors commented Apr 4, 2022

⌛ Testing commit e4fc15e with merge 9fd1cde...

@bors
Copy link
Collaborator

bors commented Apr 4, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing 9fd1cde to master...

@bors bors merged commit 9fd1cde into rust-lang:master Apr 4, 2022
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.

cast_ptr_alignment is acceptable in a narrow set of contexts
4 participants