Allow other attributes in #[pin_data] structs#122
Open
nertpinx wants to merge 1 commit intoRust-for-Linux:mainfrom
Open
Allow other attributes in #[pin_data] structs#122nertpinx wants to merge 1 commit intoRust-for-Linux:mainfrom
nertpinx wants to merge 1 commit intoRust-for-Linux:mainfrom
Conversation
When using a macro with custom attributes in a `#[pin_data]` struct it can mess up the generated `__Unpin` struct. This commit moves the decision-making of which attributes to keep into a new, separate function, so that it is unified in all places. Only `#[cfg]` and `#[doc]` attributes are kept since all other can cause issues. With this commit a struct can use both #[pin] and other custom attributes, allowing combining multiple attribute macros without clashing. To keep this functionality this commit also adds a test with a custom attribute that fails without this fix. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using a macro with custom attributes in a
#[pin_data]struct it can mess up the generated__Unpinstruct.This commit moves the decision-making of which attributes to keep into a new, separate function, so that it is unified in all places. Only
#[cfg]and#[doc]attributes are kept since all other can cause issues.With this commit a struct can use both #[pin] and other custom attributes, allowing combining multiple attribute macros without clashing.
To keep this functionality this commit also adds a test with a custom attribute that fails without this fix.
This is a rebased version of the old #94 which was originally based on the now-removed dev/syn2 branch.