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

Byte literals! #16115

Closed
wants to merge 1 commit into from
Closed

Byte literals! #16115

wants to merge 1 commit into from

Conversation

SimonSapin
Copy link
Contributor

No description provided.

0x73, //'s' as u8,
0x74, //'t' as u8,
0, 0, 0, 1 ];
pub static metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't', 0, 0, 0, 1 ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this better than

pub static metadata_encoding_version : &'static [u8] = b"rust\0\0\0\x01";

Copy link
Member

Choose a reason for hiding this comment

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

It's a little clearer that the [0, 0, 0, 1] is meant to be incremented separately if they're distinct, but it doesn't matter too much as we don't really change this ever.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I tried that too, but it seemed like the zeros and ones should be numbers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR started as a joke :) @alexcrichton said on IRC that this had never changed, so let’s change it… but not actually changing it.

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.

3 participants