Comments (6)
Thanks for the report @teor2345! This should be fixed if you run cargo update
. That Bits
associated type moved into a supertrait, so if you wrote:
T::Bits
it would continue to compile, but if you wrote:
<T as BitFlags>::Bits
then it wouldn't.
from bitflags.
We've had a few growing pains in bitflags
2.x
, but this should be the last of them now. Thanks for sticking through everything
from bitflags.
Thanks for the report @teor2345! This should be fixed if you run
cargo update
.
Unfortunately, we can't run cargo update
on our previous release tags, which have this build issue when they are built without --locked
.
Rust's semantic versioning guidelines say that all minor version updates of a single crate should be compatible:
https://doc.rust-lang.org/cargo/reference/resolver.html#semver-compatibility
So for example, we should be able to build any version of bitflags
2.* with bitflags-serde-legacy
0.1.0. But building bitflags
2.3.0 or 2.3.1 with bitflags-serde-legacy
0.1.0 currently fails. This means that the incompatible crates should be yanked.
It might seem like upgrading to bitflags-serde-legacy
0.1.1 solves this issue, but that only works if every dependency in our dependency tree allows that upgrade. (This might seem like a trivial complaint, but it's actually happened to us before with other dependencies.)
Instead, if you make these kinds of changes in a major version, then Rust will compile two separate versions of your crate into the binary. So old code will remain compatible, and new code can continue to upgrade.
If you don't want to follow the guidelines, that's ok! But please put that in your README, so other projects can decide if they want to take that risk. We might decide that we don't want to take that risk, because we don't want this kind of breakage to happen in our production releases.
from bitflags.
That
Bits
associated type moved into a supertrait, so if you wrote:T::Bitsit would continue to compile, but if you wrote:
<T as BitFlags>::Bitsthen it wouldn't.
Unfortunately, these are public items, so the semantic versioning guidelines still technically apply.
from bitflags.
Thanks @teor2345, I do understand the rules of semver and how API evolution in Rust works. The case of having two versions of that trait was exactly what I needed to avoid here because that would have required you to then issue a major breaking version of your own code. So on balance, I took a route that allowed us to evolve that trait without triggering widespread incompatibility.
I also appreciate the frustration of random build breakages in your production code. The fact that the Rust community has a culture of rigor around safety and compatibility is absolutely a good thing, but all external code comes with some level of risk and this is trivially fixed without you needing to make any changes yourself. I try to support you as a user as much as any other and take semver compatibility seriously, but can't always please everybody. I don't plan on yanking this release, or on making any more significant changes to how the public API of bitflags
works.
from bitflags.
The case of having two versions of that trait was exactly what I needed to avoid here because that would have required you to then issue a major breaking version of your own code. So on balance, I took a route that allowed us to evolve that trait without triggering widespread incompatibility.
Thanks for letting us know, and for sharing your reasoning around these changes.
I understand why this specific change happened this way, and I appreciate your quick response to this issue.
from bitflags.
Related Issues (20)
- `usize` / `isize` aren't supported anymore in `v2.0` HOT 3
- Regression in v2: flag constants no longer appear in `cargo doc` output HOT 3
- Clarify means of printing human-readable string in 2.0.0 HOT 1
- Support zerocopy HOT 4
- More methods to work with uncorresponding bits HOT 5
- Policy for unstable dependencies HOT 10
- insert_if() and remove_if() HOT 2
- feat: Add Security Policy HOT 2
- Methods on generated flags types not being detected as const HOT 6
- can't use private derive macros HOT 6
- bitflags v2.2 incompatibility with mysql_common HOT 3
- Bitflags reverses order of multiline doc comments HOT 1
- Allow opting-out of `InternalBitFlags` `fmt`/`FromStr` impls? HOT 5
- Allow external impls of Bits and BitFlags HOT 12
- Reference actions by commit SHA HOT 2
- bitflags 2.3.0 breaks flags that refer to constants in separate impl blocks via `Self` HOT 1
- Clippy Lint Failures HOT 3
- Clippy warnings around "manual implementation of an assign operation" HOT 2
- Problems deriving serde after upgrading HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitflags.