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
Conflict with display_derive
#30
Comments
Can we use more detailed name, such as |
@ErichDonGubler Thanks for the PR and being patient while I find time to look at it :) @lo48576 Are you suggesting we change the name across the board or just when this feature flag is flipped? I wish I knew the roadmap for macros a better. To entirely future-proof this issue, we could just have a flag |
I meant renaming only In contrast, To make strum future-proof (not only avoiding conflicts), using strum's own namespace (such as |
My PR wholesale disables |
With rust 2018 edition, macros can now be imported individually. For example, you could do mod a {
use strum_macros::Display;
#[derive(Display)]
enum UsesStrumDisplay {}
}
mod b {
use derive_more::Display;
#[derive(Display)]
enum UsesDeriveMoreDisplay {}
}
mod c {
use derive_more::Display;
use strum_macros::EnumString;
#[derive(Display, EnumString)]
enum UsesStrumEnumStringAndDeriveMoreDisplay {}
} I've tested importing just Could this issue be considered resolved? |
Just as a note, this is possible with Rust 2015 also -- I forget which release and I'm on mobile. Perhaps 1.30? |
@ErichDonGubler , I'm going to close this. Let me know if you disagree. |
My only concern with And to be honest, I don't care if you take a minimal support policy and say "This crate should only be expected to work on the latest Rust." So long as it's a conscious decision, then users can at least have a definitive answer to any questions about the version of their toolchain in relation to |
@Peternator7: Haven't heard a response from this, just wanted to ping you. |
Hey @ErichDonGubler , thanks for following up on this. It had slipped my mind. That's interesting official distros are so old. Let me figure out what the earliest version of rustc compiles strum. I don't plan on having extensive long term support, but at least making sure new features don't break back compat is a good start. I'll get a travis build set up for that version. |
Following up on this. The earliest version of rust right now that can compile strum is 1.26 because that's when impl trait was stabilized so I made a note on the README. It's should be possible to rename macros with some conditional feature flags like we discussed above. I'm planning on creating one flag per custom derive because the overhead for adding a feature is so small, and typically the conflict only exists with a single name so consumers won't need to refactor their entire library, only colliding names. Thanks for your patience on this. I've been busy with other things lately.
|
Housekeeping This was implemented in |
The
Display
procedural macro unfortunately conflicts with @withoutboats'display_derive
procedural macro. In some code I'm working with on a personal project, the following will compile when#[macro_use]
ing onlydisplay_derive
, but not in conjunction withstrum_derive
:Both of these crates are great additions to the ecosystem, in my opinion. It's a shame that we don't have macros as first-class items yet and that I have to choose between them. Perhaps disabling
Display
with a feature flag would be best for now?EDIT: It's also possible to use the right crate's definition by making the desired derive be imported LAST...but that's a hacky workaround.
The text was updated successfully, but these errors were encountered: