Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make the use of bitflags future-proof #15

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Conversation

glandium
Copy link
Contributor

bitflags types are opaque in bitflags 2, so defining constants using Type { bits: ... } won't work there.

Ideally, we would be able to do something like:

pub const AB: Type = Type::A | Type::B;

but | is not const when using the BitOr trait. So we rely on Type::union instead.

bitflags types are opaque in bitflags 2, so defining constants using
Type { bits: ... } won't work there.

Ideally, we would be able to do something like:
```
pub const AB: Type = Type::A | Type::B;
```

but `|` is not const when using the `BitOr` trait. So we rely on
`Type::union` instead.
@padenot padenot merged commit 0646227 into mozilla:master Sep 13, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants