Skip to content

Conversation

@0x5abe
Copy link

@0x5abe 0x5abe commented Dec 23, 2023

Sometimes derive macros need a specific attribute to be above them to work properly. I ran across this while using bilge, where the TryFromBits derive macro requires the bitsize attribute above it. The EnumDiscriminants derive macro currently doesn't allow for arbitrary attribute macros before the generated enum's derives, so I added the #[strum_discriminants(attributes(..))] attribute to allow for this.

This PR is a draft because I am not entirely sure how a test for this specific attribute would be performed, and I wouldn't want it to get merged without its proper tests.

@Peternator7
Copy link
Owner

Hey @SabeMP, I'd suggest the following. If we can find an example with serde where this would be helpful, I'd be happy to add that as a dependency to the tests crate so we can validate this works consistently.

Also, could you undo the formatting changes?

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.

3 participants