Fix env/cfg set for cargo test and cargo run.#9122
Merged
bors merged 2 commits intorust-lang:masterfrom Feb 3, 2021
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are some situations where a build script may need to run multiple times for the same package during the same
cargosession. There was a bug in that some of the values in theCompilationstruct didn't handle this case. The solution here is to be more careful about how this extra data is associated withUnits, instead of assuming a package's build script only runs once.The things that were not being handled properly:
Compilation::extra_env, which is the output ofcargo:rustc-envin build scripts. The solution here is to use theMetadatahash which is used elsewhere for distinguishing build script outputs.Compilation::cfgs, which is the output ofcargo:rustc-cfgin build scripts and the features to be set, and this is only used for doctests. The solution here is to just add those--cfgflags directly in theDocteststruct.The situations that cause a build script to be run multiple times:
host) and a cyclical dev dependency, but there are many other ways to trigger this.Fixes #9100