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

Order of generated code is not reproducible #96

Closed
emixa-d opened this issue Jun 29, 2022 · 1 comment · Fixed by #97
Closed

Order of generated code is not reproducible #96

emixa-d opened this issue Jun 29, 2022 · 1 comment · Fixed by #97
Assignees
Labels
enhancement New feature or request

Comments

@emixa-d
Copy link

emixa-d commented Jun 29, 2022

The ordering of the lines of the generated shadow.rs is irreproducible, leading to build failures with antioxidant (because dependency $foo is compiled against dependency $bar using shadow-rs, compiled on machine $X and dependency $baz is compiled against dependency $bar on another machine $Y).

The issue appears to be that hash maps are used. For now, I've worked around things by replacing

        for (k, v) in self.map.clone() {

by

        for (k, v) in std::collections::BTreeMap::from_iter(self.map.clone().iter()) {

and likewise for iteration over self.maps.keys().

(That was for rust-shadow-rs@0.8, but looking at the code it would seem that the same holds for the latest version.)

emixa-d added a commit to emixa-d/antioxidant-fallback that referenced this issue Jun 29, 2022
Link: baoyachi/shadow-rs#96

* antioxidant-packages.scm
  (rust-shadow-rs)[more-reproducibility]: Add the link.
@baoyachi
Copy link
Owner

Maybe use BTreeMap instead of HashMap

baoyachi added a commit that referenced this issue Jun 29, 2022
@baoyachi baoyachi mentioned this issue Jun 29, 2022
@baoyachi baoyachi added the enhancement New feature or request label Jun 29, 2022
@baoyachi baoyachi self-assigned this Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants