Display missing extra bits for multi-bit flags #315

Closed
opened 2023-03-15 19:16:57 -05:00 by KodrAus · 0 comments
KodrAus commented 2023-03-15 19:16:57 -05:00 (Migrated from github.com)

See: https://github.com/bitflags/bitflags/issues/310#issuecomment-1470122112

Given a flags type with two flags, BIT = 0b0000_0001 and MASK = 0b0001_1110, formatting the value 3 should result in BIT | 0x2, but instead it gives BIT. That extra bit gets lost, so doesn't roundtrip. The problem seems to be in the generated iter_names method.

See: https://github.com/bitflags/bitflags/issues/310#issuecomment-1470122112 Given a flags type with two flags, `BIT = 0b0000_0001` and `MASK = 0b0001_1110`, formatting the value `3` should result in `BIT | 0x2`, but instead it gives `BIT`. That extra bit gets lost, so doesn't roundtrip. The problem seems to be in the generated `iter_names` method.
Sign in to join this conversation.
No labels
bug
good first issue
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-bitflags/bitflags#315
No description provided.