Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Let is_all() ignore extra bits (fixes #208) #211

merged 1 commit into from May 16, 2021


Copy link

@niklasf niklasf commented Feb 4, 2020

Changes is_all() to match the documented behavior in the presence of extra bits:

Returns true if all flags are currently set.

This is only relevant when unsafe from_bits_unchecked() has been used to create an instance with bits that do not correspond to any defined flag.

let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
assert!(!(Flags::A | extra).is_all());
assert!((Flags::ABC | extra).is_all());
Copy link
Contributor Author

@niklasf niklasf Feb 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously false, even though all flags (and one more bit) were set.

Copy link

KodrAus commented May 16, 2021

This looks reasonable to me! Thanks @niklasf

@KodrAus KodrAus merged commit ae4f46f into bitflags:master May 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants