-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo config: Rustflags are concatenated in non-deterministic order #4935
Comments
alexcrichton
added a commit
to alexcrichton/cargo
that referenced
this issue
Jan 16, 2018
The usage of `HashMap` in the `Config` tables introduced some nondeterminism, so reverse that with a sort right before we pass it down to rustc. One day we'll probably want to sort by the position where these keys were defined, but for now a blanket sort should do the trick. Closes rust-lang#4935
bors
added a commit
that referenced
this issue
Jan 16, 2018
Ensure `[target]` rustflags are deterministically passed The usage of `HashMap` in the `Config` tables introduced some nondeterminism, so reverse that with a sort right before we pass it down to rustc. One day we'll probably want to sort by the position where these keys were defined, but for now a blanket sort should do the trick. Closes #4935
bors
added a commit
that referenced
this issue
Jan 17, 2018
Ensure `[target]` rustflags are deterministically passed The usage of `HashMap` in the `Config` tables introduced some nondeterminism, so reverse that with a sort right before we pass it down to rustc. One day we'll probably want to sort by the position where these keys were defined, but for now a blanket sort should do the trick. Closes #4935
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
According to the Cargo Docs, defining rustflags in multiple target configurations concatenates them:
However this happens in a non-deterministic order:
Using this sample .cargo/config file
and this main.rs:
results in a different output each compilation.
Resolving the concatenation deterministically would surely be desirable.
I would propose resolving them in the order of appearance in the config file, and with project-local configs having precedence over those higher in the directory hierarchy.
The text was updated successfully, but these errors were encountered: