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

Make order of bitflags values deterministic #564

Merged
merged 2 commits into from
Aug 25, 2021
Merged

Make order of bitflags values deterministic #564

merged 2 commits into from
Aug 25, 2021

Conversation

jonas-schievink
Copy link
Contributor

Fixes #563

Since each bitflags value is stored in its own symbol, their order in the final executable is up to rustc/LLVM, or even the linker. This causes unreliable output that depends on toolchain details.

This PR fixes that by storing an index in the symbol for bitflags values, which indicates their order in the source code. The decoder sorts by this index to put the values back in definition order. We now exactly match the output of the bitflags crate.

Copy link
Member

@Urhengulas Urhengulas left a comment

Choose a reason for hiding this comment

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

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 25, 2021

Build succeeded:

@bors bors bot merged commit 45beb42 into knurling-rs:main Aug 25, 2021
@jonas-schievink jonas-schievink deleted the fix-bitflags-value-order branch August 25, 2021 17:16
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.

bitflag snapshot tests fail on nightly
2 participants