

Add deployment-target --print flag for Apple targets by BlackHoleFox · Pull Requ...
source link: https://github.com/rust-lang/rust/pull/105354
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Conversation
Contributor
This is very useful for crates that need to know what the Apple OS deployment target is for their build scripts or inside of a build environment. Right now, the defaults just get copy/pasted around the ecosystem since they've been stable for so long. But with #104385 in progress, that won't be true anymore and everything will need to move. Ideally whenever it happens again, this could be less painful as everything can ask the compiler what its default is instead.
To show examples of the copy/paste proliferation, here's some crates and/or apps that do:
- cc, Soon
- mac-notification-sys
- PyO3
- Anki
- jsc-rs
... and probably more that a simple GitHub codesearch didn't see
Collaborator
(rustbot has picked a reviewer for you, use r? to override) |
added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Collaborator
These commits modify compiler targets. |
Contributor
Author
@rustbot label O-macos O-ios |
Contributor
Author
So far I'm unsure of the flag name. |
r? compiler |
Contributor
r? @oli-obk |
Contributor
This adds a new insta-stable compiler flag. This seems like a good solution to the problem for me. @rfcbot fcp merge |
Team member @oli-obk has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it.
labels
src/doc/rustc/src/command-line-arguments.md
Outdated Show resolved
"ios" => ios_deployment_target(), |
||
"watchos" => watchos_deployment_target(), |
||
"tvos" => tvos_deployment_target(), |
||
_ => unreachable!("unknown Apple target OS"), |
This arm is reachable with custom target specs.
I suggest returning an Option
here, and relying on it in the driver instead of using sess.target.is_like_osx
.
Contributor
Author
Ah, thanks, and good to know. Moved up to rustc_driver
. For the future, why is doing it there better? Do custom target specs go through a different codepath that wouldn't panic?
This comment has been minimized.
added the A-testsuite Area: The testsuite used to check the correctness of rustc label
Contributor
Author
There's now also a test for valid use of the new flag. It isn't very picky about the output beyond requiring that it only contains |
Contributor
|
removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label
Member
One concern I have with making It may also be worth considering if crates may want to For what it is worth, multiple |
Member
This has been discussed many times, https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Pre-RFC.3A.20CFG.20OS.20Version is one of the more recent efforts. Anecdotally, they seem to tend to hit snags as they often come in with only planned support for a single OS, and wish to leave the others as future work, which may not be viable (in the case of Apple targets, given that we already have support for this in the compiler as it's not exactly an optional aspect of those targets, my feeling is that it seems like it would need to be addressed). Regardless, I'm not sure these two overlap that much -- the cfgs that have been suggested are in the form of an |
Contributor
Author
Like what @thomcc said, I think this should exist in parallel with a hypothetical
In the same grouping as the other
At least on Apple platforms, I don't know what else would be useful for cargo to get from
Do you mean something like |
Member
Something as simple as |
added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised.
and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
labels
|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
No milestone
Successfully merging this pull request may close these issues.
None yet
Recommend
-
14
The Rust team regrets to announce that Rust 1.41.0 (to be released on January 30th, 2020) will be the last release with the current level of support for 32-bit Apple targets. Starting from Rust 1.42.0, those targets will b...
-
13
Apple's horrible new maps shouldn't have been a flag day It's been a couple of months since iOS 6 hit and forced users to deal with a suboptimal mapping experience. I wrote
-
7
AutosDecember 22, 20204:41 AMUpdated 4 hours agoExclusive: Apple targets car production by 2024 and eyes 'next level' battery technolo...
-
20
Apple targets car production by 2024Key PointsTim Cook presents at the Apple launch event in Cupertino, Calif on Sept. 10th, 2019.Source: Apple
-
7
20 Jul 2020 software-dev
-
10
Bipartisan bill targets Apple and Google's ability to profit from app storesKey PointsIn this articleVIDEO03:59Senators Blackburn and Blumenthal di...
-
5
Apple will ask before it targets you with its ads in iOS 15Illustration by Alex Castro / The Verge Apple will start asking for permission to enable Personalized Ads in iOS 15, the company’s method of serving relevant ads in the...
-
4
Collaborator rustbot commented
-
8
The AI computing boom: OctoML targets machine learning workload deployment
-
7
Conversation Contributor...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK