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

Eliminate all use of hash-based collections from crate_universe #1737

Merged
merged 1 commit into from
Jan 1, 2023

Conversation

dtolnay
Copy link
Contributor

@dtolnay dtolnay commented Jan 1, 2023

This is necessary together with #1736 to keep the generated BUILD files deterministic. Iterating a hashmap or hashset in hash order is a common source of nondeterminism in code generators (based on my experience with proc macros).

I haven't looked into which of the hashmaps changed in this diff are correctly used. It's possible to use a hashmap correctly, if all we do with them is lookups, not iteration. But it's simple enough to just not use hash-based containers entirely and never have hash order nondeterminism problems.

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Great find and thanks for the pull-request!

@UebelAndre UebelAndre merged commit 52e02c2 into bazelbuild:main Jan 1, 2023
@dtolnay dtolnay deleted the btrees branch January 1, 2023 18:33
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.

None yet

2 participants