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
Adding visibility option vis(...)
to #[strum_discriminants]
(#137)
#138
Conversation
vis(...)
to #[strum_discriminants]
(#137)
Seems that Rust 1.31 isn't happy with using |
Thanks for jumping in to help!! I haven't seen an error like this before, but jumping around rust versions, it appears this behavior changed between 1.33 and 1.34, and it looks like the error is with rustc parsing the "pub" in the macro attribute as a keyword, and not actually related to the code being generated. |
If strict compatibility with Rust 1.31+ is needed, perhaps the |
I'm not too worried about compatibility because this is a new feature so it shouldn't break any existing code. Let's do this:
|
@Peternator7 Thanks! I tried out using "r#pub", and now it's the opposite: it only works on 1.31, and breaks the other Rust version builds. It seems I'd need to do a cfg of some sort for Rust <= 1.33 to use |
And to make things even trickier, it seems that even behind a |
Quite the catch-22 isn't it 👎 I think I see a few options here:
I'm leaning towards option 3 because the other 2 seem unfeasible. It's not great that the doc won't be tested, but you've added test cases so we should still catch any regressions. |
When I pulled your branch locally, I couldn't repro the |
@Peternator7 Of the three, I agree that no. 3 sounds the best. I'll proceed down that route, this would be a separate code block example right underneath the main one, correct?
I saw this error on travis, trying to build using Rust 1.31. I didn't try changing versions of my Rust toolchain locally, it was using Rust 1.47. |
Suggestion no. 3 worked great! Travis and AppVeyor look happy with the results. 😄 |
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.
Looks great! Glad the builds are working. Only one comment. I think we can deduplicate some code.
Merged; thanks for the PR! I'll work on getting a release out this week. |
Awesome, thanks a bunch! |
Strum |
Closes #137
Validated using doctest example in the
EnumDiscriminants
section. While I was able to show in the doctest that I'm able to use the public discriminants properly (i.e. they work and are visible), I'm not sure how to show that I'm not exposing the original enum publicly. If anyone has suggestions for that, that would be helpful to include!