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

Don't expose bit flag operations quite so much to the user. #161

Merged
merged 1 commit into from
Nov 27, 2020

Conversation

ltratt
Copy link
Contributor

@ltratt ltratt commented Nov 27, 2020

Using 'bitflags' gives us the same internal representation but slightly more static type safety.

Using 'bitflags' gives us the same internal representation but slightly more
static type safety.
#[derive(Serialize, Deserialize)]
pub struct BodyFlags: u8 {
/// This function is annotated #[do_not_trace].
const DO_NOT_TRACE = 0b00000001;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use the 1<<X idiom? It's easier to read and less error prone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used to use 1<<X but I've made too many mistakes with it to be fond of it any more. To be honest, I didn't think deeply about this: I think all of the examples you'll find using bitflags use the 0b notation, which suggests that's what people have gravitated towards.

@vext01
Copy link
Contributor

vext01 commented Nov 27, 2020

Just an easy comment. Looks good.

@ltratt
Copy link
Contributor Author

ltratt commented Nov 27, 2020

@vext01 Does this PR need separate borsing?

@vext01
Copy link
Contributor

vext01 commented Nov 27, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 27, 2020

Build succeeded:

@bors bors bot merged commit 6c8badc into ykjit:master Nov 27, 2020
@ltratt ltratt deleted the remove_bit_ops branch December 14, 2020 18:21
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.

2 participants