-
Notifications
You must be signed in to change notification settings - Fork 19
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
Update bitflags dependency to v2 #38
Conversation
Currently, `cargo tree` run shows the crate depending on both bitflags v1 (directly) and v2 (through dependencies). However, the crate seems to compile just fine with bitflags v2.
While it may compile fine on the surface, the public bitflags API changed significantly enough to need extra code changes. I recommend you to take a look at the corresponding changelog items for a migration guide. |
gbm.rs exposes `bitflags!`-generated macro in its public API, so to preserve backward compatibility I added: * Explicit `derive` for some builtin traits, * A definition for `from_bits_unchecked` that got replaced in `bitflags` by safe `from_bits_retain`. I marked that one as deprecated. I checked the API surface compatibility with gbm v0.14.2 by running [cargo-semver-checks](https://github.com/obi1kenobi/cargo-semver-checks). I also generated [a diff](https://gist.github.com/dextero/05f14b287e6c0157347229cf5f361270) that highlights elements changes to the public API of `BufferObjectFlags` using [cargo-public-api](https://github.com/Enselic/cargo-public-api). The output lists a handful of additions and one change: making `BufferObjectFlags` a tuple struct (in v1, it was a struct with private `bits` field). Besides the changes highlighted by the tooling above, I didn't find other updates that could be needed by going through the [changelog items](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md).
Thank you for taking a look, and for the fast response! I added:
I checked the API surface compatibility with gbm v0.14.2 by running cargo-semver-checks. It found no issues with the updated PR. I also generated a diff that highlights changes to the public API of The output lists no deletes, a handful of additions and one change: making Besides the changes highlighted by the tooling above, I didn't find other updates that could be needed by going through the changelog items (unfortunately I couldn't find a proper migration guide). I'd be grateful if let could me know if I missed any other checks that you usually do, or if this doesn't seem like a worthwhile effort at all. |
While I think this should mostly be compatible with downstream, looking at the diff and the bitflags 2.0 release, it seems like the generated struct doesn't have a I might just merge this, but wait for a future 0.15 release to actually include it. |
Thanks for picking this up with mininmal info! I don't think GBM absolutely needs semver-compatibility for these things as it's still in the
It doesn't seem to have been merged there, but it was edited into the GitHub release tag (https://github.com/bitflags/bitflags/releases/tag/2.0.0) after I created an issue about not having an immediate clue about these "hidden" changes. Specifically, I'd look at the serialization flags. A tad annoying because it might imply an optional dependency on (Perhaps worth making an issue about the
If we do, we might as well drop the deprecated backwards-compatible |
As suggested in Smithay#38 (comment) Checked with: cargo check --no-default-features cargo check --all-features cargo public-api diff @~..@ cargo public-api diff --all-features @~..@ Diff results: https://gist.github.com/dextero/72cf3722e468be7cdb67a62ce16abc9d
Welp, one more place to look for info in the future, thanks for sharing! It's useful to know a bit better in how many ways one can break compatibility with seemingly minor changes 😅
I added optional
👍 done too. |
bitflags does not define its dependency precisely enough which makes -Z minimal-versions build fail.
Annnnd it turns out I'll suggest a patch in |
Yeah, A patch in I'll leave it to the |
|
If there is anyone, who actually needs this, they will be delighted. And given it is not enabled by default, I don't see any issue with this. Thanks for all the work, I think this is good for merge now. |
Currently,
cargo tree
run shows the crate depending on both bitflags v1 (directly) and v2 (through dependencies). However, the crate seems to compile just fine with bitflags v2.