-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Allow bitflags v1
and v2
to coexist
#877
Comments
v1
and v2
to coexist
The important note here is co-exist. Any support for bitflags v2 has to use a new name for the macro, and we have to support the old one at the same time. Imagine Application X depends on Library A and Library B. Library A wants to use the existing bitflags API but Library B is newer and wants to use the newer bitflags v2 API (that we haven't added yet, but that we might add). Both crates need to be compiled using the exact same set of cargo features, because that's how cargo works unfortunately. |
True. So I propose the following:
@jonathanpallant do you see any problems with that approach? cc @manushT |
Do we have any existing features and is anyone out there likely to be using defmt with The other option is:
It's still not unclear to be if anyone needs us to upgrade to bitflags v2. It's an improvement, but I don't think bitflags v1 is broken for anyone right now. |
There is a
defmt::bitflags!
macro which depends on thebitflags::bitflags!
macro from thebitflags v1
crate. Since it's introduction there was abitflags v2
, but unfortunately we cannot just bump the dependency, since thedefmt::bitflags!
macro leaks implementation details of thebitflags::bitflags!
macro and therefore the dependency update could break the code of defmt users.Therefore we want to add two new cargo features to defmt:
bitflags1
andbitflags2
. They each gate adefmt::bitflags
macro which depends onbitflags v1
andbitflags v2
respectively. To not break any existing code, thebitflags1
feature should be enabled by default. Acompile_error
when both are enabled sounds useful as well.Note that there is an existing PR to update to bitflags v2: #746.
The text was updated successfully, but these errors were encountered: