Comments (9)
Thanks for the report @MolotovCherry. I’ll check this out. I wouldn’t expect things to break between minor releases unless there’s some reliance on specific debug formatting.
from bitflags.
I found the root cause of the bug, and it's not an issue with bitflags
, rather swc
doing something unsanctioned that just happened to work for about 5 years until it didn't because of a change in implementation detail.
I'll write up the issue (or a PR) with details on the swc
repo and link here.
from bitflags.
The original bug here should be fixed as of 2.3.3
.
from bitflags.
Thanks for the update @kosayoda. Those are my favourite kinds of bugs
I’ve been on holidays this week so haven’t had a chance to dig into this yet.
from bitflags.
Following the linked PR it looks like you might have run into this issue.
For what it’s worth, I think that is a bug in bitflags
and am currently working through revamping our test suite to better specify the behaviour of methods when there are bits set that don’t correspond to known flags.
from bitflags.
Ah that does make sense. I think it boils down to whether adding new flags external to the bitflags
macro ("external API" use case in the linked issue) should be sanctioned, which on first instinct I don't think it should due to the amount of edge cases in the implementation details.
from bitflags.
I think where possible we’ll try respect bits that don’t correspond to known flags. So if the bitwise operation on the underlying integer would retain that bit then the operation on the flags type will too.
The only case that gets a bit weird I think is !
, where we don’t want to set all unset bits, so it just unconditionally clears any bits that don’t correspond to known flags.
from bitflags.
I've opened #366 to fix this, and think we've hashed out a plan for a 3.x
release that should make these operators fully consistent in their support flags types with externally defined flags.
If you've got any thoughts on that I'd love to hear them!
from bitflags.
This is great. I tested 2.3.3 with the original example which had the problem, and it now shows the correct output. Thanks a lot!
from bitflags.
Related Issues (20)
- 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
- Breaking change released as 2.3.0, which causes build failures on upgrade HOT 6
- Problems deriving serde after upgrading HOT 2
- Treatment of unknown bits in operators is inconsistent HOT 18
- Inconsistent debug output for flag with no bits HOT 4
- Flagging supply-chain security issues HOT 3
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.