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

Enable cfg predicate for target_feature = "crt-static" only if the target supports it #71775

Merged
merged 1 commit into from
May 10, 2020

Conversation

petrochenkov
Copy link
Contributor

That's what all other target_features do.

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(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 May 1, 2020
@petrochenkov
Copy link
Contributor Author

The annoying question here is "what happens if the target supports crt-static for executables, but not for libraries" (or vice versa).

At configuration time we don't know the crate type(s) produced by the code - it may be specified by attributes.
We also may produce multiple crate types in one run of rustc, including both executables and libraries, and code for them must not diverge until link time.
So we set the cfg predicate if the target supports crt-static for any of the possible crate types, basically.

Fortunately, cfg(target_feature = "crt-static") is generally used in lazy link-time configuration (#[link(name = "foo", cfg(target_feature = "crt-static"))]) rather than in early expansion-time configuration, so it shouldn't be a problem.

@bors
Copy link
Contributor

bors commented May 3, 2020

☔ The latest upstream changes (presumably #71807) made this pull request unmergeable. Please resolve the merge conflicts.

@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 8, 2020

📌 Commit 33b6631 has been approved by matthewjasper

@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 May 8, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 9, 2020
Enable `cfg` predicate for `target_feature = "crt-static"` only if the target supports it

That's what all other `target_feature`s do.
@bors
Copy link
Contributor

bors commented May 10, 2020

⌛ Testing commit 33b6631 with merge 8d16eeb...

@bors
Copy link
Contributor

bors commented May 10, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: matthewjasper
Pushing 8d16eeb to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 10, 2020
@bors bors merged commit 8d16eeb into rust-lang:master May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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