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

Fix -Zfeatures=itarget with certain host dependencies #8048

Merged
merged 1 commit into from
Mar 27, 2020

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Mar 27, 2020

In some cases, -Zfeatures=itarget can panic because an entry is missing in the activation map. This happens because the way "for_host" was tracked when building the activation map. Previously "for_host" was only set when -Zfeatures=host_dep was specified. However, if you don't specify host_dep, then "for_host" was always false.

This is a problem because itarget needs to also be able to detect if something is enabled for the host or target. If you have a proc-macro ("for_host"), and it has a dependency with a [target] specification that matched the host, then the activation map would fail to include it (because the "for_host" flag was not "sticky" and didn't get passed down).

The solution is to always carry the "for_host" setting around while building the activation map. Only when inserting a feature into the map will it check if opts.decouple_host_deps is set. This allows it to handle the "for_host" setting correctly, even if the host_dep option isn't enabled.

This was discovered at #7914 (comment) where a dependency on hashbrown would fail if you pass --target something_not_unix because it has a unix-only dependency for libc.

(Sorry, long-winded explanation. Please ask if that is confusing.)

@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 27, 2020
@alexcrichton
Copy link
Member

@bors: r+

Nah this makes sense to me, thanks for digging in here!

@bors
Copy link
Collaborator

bors commented Mar 27, 2020

📌 Commit 86ee8ce has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 27, 2020
@bors
Copy link
Collaborator

bors commented Mar 27, 2020

⌛ Testing commit 86ee8ce with merge 231777f...

@bors
Copy link
Collaborator

bors commented Mar 27, 2020

☀️ Test successful - checks-azure
Approved by: alexcrichton
Pushing 231777f to master...

@bors bors merged commit 231777f into rust-lang:master Mar 27, 2020
Centril added a commit to Centril/rust that referenced this pull request Apr 2, 2020
Update cargo

8 commits in 8a0d4d9c9abc74fd670353094387d62028b40ae9..6e07d2dfb7fc87b1c9489de41da4dafa239daf03
2020-03-24 17:57:04 +0000 to 2020-03-31 03:22:39 +0000
- Fix man page typo for "Owner Options". (rust-lang/cargo#8057)
- enable progress bar on all UNIX platforms (rust-lang/cargo#8054)
- Squelch some rustdoc warnings. (rust-lang/cargo#8052)
- Remove clippy tests. (rust-lang/cargo#8053)
- Fix -Zfeatures=itarget with certain host dependencies (rust-lang/cargo#8048)
- Checking for binary that is built as an implicit dependency of an integration test. (rust-lang/cargo#8020)
- Use stabilized version of rustdoc's --crate-version (rust-lang/cargo#8039)
- Remove the `git-checkout` subcommand. (rust-lang/cargo#8040)
Centril added a commit to Centril/rust that referenced this pull request Apr 2, 2020
Update cargo

8 commits in 8a0d4d9c9abc74fd670353094387d62028b40ae9..6e07d2dfb7fc87b1c9489de41da4dafa239daf03
2020-03-24 17:57:04 +0000 to 2020-03-31 03:22:39 +0000
- Fix man page typo for "Owner Options". (rust-lang/cargo#8057)
- enable progress bar on all UNIX platforms (rust-lang/cargo#8054)
- Squelch some rustdoc warnings. (rust-lang/cargo#8052)
- Remove clippy tests. (rust-lang/cargo#8053)
- Fix -Zfeatures=itarget with certain host dependencies (rust-lang/cargo#8048)
- Checking for binary that is built as an implicit dependency of an integration test. (rust-lang/cargo#8020)
- Use stabilized version of rustdoc's --crate-version (rust-lang/cargo#8039)
- Remove the `git-checkout` subcommand. (rust-lang/cargo#8040)
@ehuss ehuss added this to the 1.44.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants