-
Notifications
You must be signed in to change notification settings - Fork 105
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
[derive] Overhaul repr parsing #1752
Conversation
adabb75
to
c964ce7
Compare
fc843e0
to
546e95a
Compare
546e95a
to
bc41d52
Compare
2148b46
to
fa664c3
Compare
d806d1a
to
cc2acfe
Compare
Represent the result of parsing all `#[repr(...)]` attributes on a type as a high-level type which is only capable of representing valid combinations of `#[repr(...)]` attributes and processes them into a concise representation that's easier for high-level code to work with. This prepares us to more easily fix #1748. While we're here, we make a number of other improvements. 1) Errors are now converted to `TokenStream`s as late as possible rather than as early as possible, which was the previous behavior. This allows us to bail early when deriving an implied trait fails (e.g., deriving `TryFromBytes` when the user wrote `#[derive(FromZeros)]`). 2) Avoid re-computing some repr information in `TryFromBytes` enum support.
cc2acfe
to
a5ebe1a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1752 +/- ##
=======================================
Coverage 87.46% 87.46%
=======================================
Files 16 16
Lines 6021 6021
=======================================
Hits 5266 5266
Misses 755 755 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed over video call.
Addressed all feedback; re-reviewed by @jswrenn
Represent the result of parsing all
#[repr(...)]
attributes on a type as a high-level type which is only capable of representing valid combinations of#[repr(...)]
attributes and processes them into a concise representation that's easier for high-level code to work with.This prepares us to more easily fix #1748.
While we're here, we make a number of other improvements.
TokenStream
s as late as possible rather than as early as possible, which was the previous behavior. This allows us to bail early when deriving an implied trait fails (e.g., derivingTryFromBytes
when the user wrote#[derive(FromZeros)]
).TryFromBytes
enum support.