Skip to content

Conversation

@Nashenas88
Copy link
Contributor

@Nashenas88 Nashenas88 commented Jun 4, 2020

Taking a reference to a misaligned field on a packed struct is an
unsafe operation. Highlight that behavior. Currently, the misaligned
part isn't tracked, so this highlight is a bit too aggressive.

Fixes #4600

@Nashenas88 Nashenas88 marked this pull request as ready for review June 8, 2020 12:59
@Nashenas88 Nashenas88 requested a review from matklad July 19, 2020 16:02
} else {
None
}
})();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-invoking closures are neat, but is there perhaps a way to write this simpler, without deploying intricate language machinery?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up. Does the new version need comments or is it pretty clear?

@Nashenas88 Nashenas88 requested a review from matklad July 23, 2020 14:28
@Nashenas88 Nashenas88 requested a review from matklad July 23, 2020 22:37
@Nashenas88 Nashenas88 requested a review from matklad July 30, 2020 13:27
@Nashenas88 Nashenas88 force-pushed the packed-ref-unsafe branch 3 times, most recently from bc47803 to 017c8b2 Compare August 9, 2020 15:22
Nashenas88 and others added 16 commits August 10, 2020 08:44
Taking a reference to a misaligned field on a packed struct is an
unsafe operation. Highlight that behavior. Currently, the misaligned
part isn't tracked, so this highlight is a bit too aggressive.
…irst param for self information in syntax highlighting instead
…ator, using functional methods rather than clunky inline closure
@matklad
Copy link
Contributor

matklad commented Aug 12, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 12, 2020

@bors bors bot merged commit 11de7ac into rust-lang:master Aug 12, 2020
@Nashenas88 Nashenas88 deleted the packed-ref-unsafe branch August 12, 2020 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track repr(packed) and track unsafe references of fields to packed structs.

4 participants