Skip to content

unaligned_references: align(N) fields in packed(N) structs are fine #83605

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Mar 29, 2021

Conversation

RalfJung
Copy link
Member

This removes some false positives from the unaligned_references lint: in a repr(packed(2)) struct, fields of alignment 2 (and less) are guaranteed to be properly aligned, so we do not have to consider them "disaligned".

@rust-highfive
Copy link
Contributor

r? @petrochenkov

(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 Mar 28, 2021
@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

r=me with the failing test updated.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 28, 2021
@RalfJung RalfJung added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 28, 2021
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 28, 2021
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 28, 2021

📌 Commit 1ab05c1 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 28, 2021
@bors
Copy link
Collaborator

bors commented Mar 29, 2021

⌛ Testing commit 1ab05c1 with merge cc41030...

@bors
Copy link
Collaborator

bors commented Mar 29, 2021

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing cc41030 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 29, 2021
@bors bors merged commit cc41030 into rust-lang:master Mar 29, 2021
@rustbot rustbot added this to the 1.53.0 milestone Mar 29, 2021
@RalfJung RalfJung deleted the unaligned branch April 6, 2021 09:02
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 3, 2022
fix is_disaligned logic for nested packed structs

rust-lang#83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests.

Fixes rust-lang#99838
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 20, 2024
fix is_disaligned logic for nested packed structs

rust-lang/rust#83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests.

Fixes rust-lang/rust#99838
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
fix is_disaligned logic for nested packed structs

rust-lang/rust#83605 broke the `is_disaligned` logic by bailing out of the loop in `is_within_packed` early. This PR fixes that problem and adds suitable tests.

Fixes rust-lang/rust#99838
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants