rework the way cfgs are handled by KodrAus · Pull Request #281 · bitflags/bitflags · GitHub
Skip to content

rework the way cfgs are handled - #281

Merged
KodrAus merged 9 commits into
bitflags:mainfrom
KodrAus:chore/all-cleanup
May 10, 2022
Merged

KodrAus merged 9 commits into
bitflags:mainfrom
KodrAus:chore/all-cleanup

Conversation

@KodrAus

@KodrAus KodrAus commented May 3, 2022 •

Copy link
Copy Markdown
Member

Closes #137
Closes #198
Closes #215

The current approach for handling #[cfg]'d flags is to define a trait that includes all names unconditionally, and then only set them to values based on actual #[cfg]'s. Unfortunately this means we can't support redefining flags (they'd appear twice in the unconditional list). This approach simplifies things by defining an internal Bits trait that captures the operations we require of primitive bits types. We now define all as from_bits_truncate with all bits set.

@KodrAus

KodrAus commented May 3, 2022

Copy link
Copy Markdown
Member Author

@KodrAus

KodrAus commented May 4, 2022

Copy link
Copy Markdown
Member Author

Getting back to having a single macro that defines bitflags types should make it much easier for us to do #264 properly. After that I think we're just about ready for the next major release (the first with the BitFlags trait).

@KodrAus
KodrAus merged commit 810dc35 into bitflags:main May 10, 2022
@hillin

hillin commented Aug 16, 2022

Copy link
Copy Markdown

When is this change going to be released?

@hillin

hillin commented Aug 18, 2022 •

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug formatting leads to less desireable output Support allow non_upper_case_globals lint. Constants cannot be cfg-gated multiple times

2 participants