-
Notifications
You must be signed in to change notification settings - Fork 48
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
Deprecate target_vendor #102
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. |
@rustbot second |
This is persuasive to me. On question: What, technically, do you expect "deprecated" to mean here? My guess: (Is there any desire to also add warnings about it?) |
Oh wait, this is a t-lang not a t-compiler MCP. I guess somebody else will have to second and mine doesn't count (though I do think this should happen regardless) |
@nagisa Your support still carries weight, though procedurally this does need a second from a lang team member. |
@scottmcm (Responded on Zulip.) |
[moved to zulip - sorry, I scrolled right past the "don't post technical comments here" notice] |
@rustbot second Sure, I can liason this. |
(This isn't the place for the discussion, but commenting in Zulip tends to get forgotten after things merge, and I think this is worth recording -- responses to this should be in Zulip, probably) While I'm l actually in favor of the proposal, there's one part I think is problematic, which I would like to record somewhere.
This is could be a bigger issue than anticipated -- As I note here: https://internals.rust-lang.org/t/futher-extensions-to-cfg-target-family-and-concerns-about-breakage/16313, it's pretty likely that Anyway, this isn't an objection to deprecating target vendor, it's an objection to the proposed solution for apple targets. I think we should avoid adding further multi-valued to target-family until we have a better idea of how much this will break. |
I created a tracking issue as described on the initiatives process. @joshtriplett , if you think a distinct zulip stream is warranted here, let me know and I can create it. I'm honestly a little hesitant to create a distinct zulip stream for each one of these MCPs. |
Being deprecated, see: * <rust-lang/lang-team#102> * <rust-lang/rust#100343>
Being deprecated, see: * <rust-lang/lang-team#102> * <rust-lang/rust#100343>
Being deprecated, see: * <rust-lang/lang-team#102> * <rust-lang/rust#100343>
…ux, r=<try> [EXPERIMENT] Crater adding `target_family = "linux"` The lang team proposed, a while back, [deprecating `target_vendor`](rust-lang#100343). With five operating systems all from Apple, using very similar, unifying characteristics for each, it is untenable to ask people to `cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))`. It is commonly preferred to use `target_vendor = "apple"` for things that are true for all of these OS variants, and we have to offer a replacement that is equally parsimonious. [The "obvious" choice is to add a `target_family = "apple"`](rust-lang/lang-team#102 (comment)). However, [there is a concern that adding a `target_family = "apple"` won't work without massive ecosystem breakage, because of poorly-designed build scripts](rust-lang/lang-team#102 (comment)). But we currently can't crater a test of that effectively, because most tests only test host compilation, and crater only runs on Linux. We could, however, test adding a hypothetical `target_family = "linux"`! This would be a hypothetical `target_family` that unites both `target_os = "linux"` and `target_os = "android"` targets. This isn't necessarily an "apples to apples" comparison (more like "penguins to robots"?) but it seems worth trying. Note that this is **not** a proposal to actually add such a `target_family`. I don't have any arguments about the merits beyond "it seems like a plausible target family we may one day add, it can be added in a way that disrupts relevant build scripts, and it impacts a 'high-value' target". For maximum coverage I have in fact added the relevant `target_family = "apple"` and `target_family = "linux"` also just in case any test suites somehow run cross-compilation tests.
…ux, r=<try> [EXPERIMENT] Crater adding `target_family = "linux"` The lang team proposed, a while back, [deprecating `target_vendor`](rust-lang#100343). With five operating systems all from Apple, using very similar, unifying characteristics for each, it is untenable to ask people to `cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos", target_os = "tvos", target_os = "visionos"))`. It is commonly preferred to use `target_vendor = "apple"` for things that are true for all of these OS variants, and we have to offer a replacement that is equally parsimonious. [The "obvious" choice is to add a `target_family = "apple"`](rust-lang/lang-team#102 (comment)). However, [there is a concern that adding a `target_family = "apple"` won't work without massive ecosystem breakage, because of poorly-designed build scripts](rust-lang/lang-team#102 (comment)). But we currently can't crater a test of that effectively, because most tests only test host compilation, and crater only runs on Linux. We could, however, test adding a hypothetical `target_family = "linux"`! This would be a hypothetical `target_family` that unites both `target_os = "linux"` and `target_os = "android"` targets. This isn't necessarily an "apples to apples" comparison (more like "penguins to robots"?) but it seems worth trying. Note that this is **not** a proposal to actually add such a `target_family`. I don't have any arguments about the merits beyond "it seems like a plausible target family we may one day add, it can be added in a way that disrupts relevant build scripts, and it impacts a 'high-value' target". For maximum coverage I have in fact added the relevant `target_family = "apple"` and `target_family = "linux"` also just in case any test suites somehow run cross-compilation tests.
Proposal
Summary and problem statement
Target names (sometimes called target "triples" despite having two, four, or five components) have a field for the "vendor" of a system. This field is vestigial, and ideally Rust code should never need to match on it to distinguish targets. All modern targets are effectively distinguished by architecture, OS, environment, and ABI, with the exception of a few target names invented solely for Rust. We should not use the
target_vendor
field to distinguish future targets; we should distinguish targets using more semantically meaningful fields.Motivation, use-cases, and solution sketches
I propose to prevent any new targets from being distinguished solely by "vendor", and I propose to deprecate the
target_vendor
field, with a transition plan for the Rust-originated targets that currently exist. (I do not propose to change the name of any existing target.)The existing Rust-originated targets where
target_vendor
matters:Windows UWP targets use
target_vendor
as the only distinction from the corresponding non-UWP Windows targets:For these targets, I propose to set
target_abi = "uwp"
, and encourage code to use that instead. I don't propose to change the name of these targets.The SGX target,
x86_64-fortanix-unknown-sgx
, usestarget_vendor
to distinguish between the fortanix SGX API/ABI and a hypothetical future SGX API/ABI from another vendor. I propose to settarget_abi = "fortanix"
for this target, as in practice that's the purpose this field serves.We have a deprecated Solaris compatibility target,
x86_64-sun-solaris
, similar tox86_64-pc-solaris
. I propose to leave this target untouched, as it's already deprecated; that transition should continue as planned.Finally, Apple targets set
target_vendor = "apple"
, and some code uses this to match both iOS and macOS. We could optionally addtarget_family = "apple"
for these targets, in addition to the existingtarget_family = "unix"
. Rust supports having multiple "family" values set, though this has the possibility of breaking fragile build scripts that match the entire value ofCARGO_CFG_TARGET_FAMILY
rather than treating it as a list.Once
target_abi
is stable and the UWP and Fortanix targets settarget_abi
, and the Apple targets settarget_family
, I propose to carefully deprecate thetarget_vendor
field, by adding a warn-by-default future-compatibility lint.target_vendor
should continue to work for several years. We may eventually choose to remove it in a future edition.We may optionally choose to start warning about uses of
target_vendor
that don't look foruwp
orfortanix
early, and then just suppress warnings about checks for those two values untiltarget_abi
is stable.For future new targets, I propose to omit the "vendor" component entirely unless needed for compatibility with naming already used by other existing widespread toolchains. Whenever we create a new target name, we should omit the "vendor" element entirely, as we did for
wasm32-wasi
.Links and related work
Target "triples" originated with autotools. The maintainer of autoconf, @zackw, wrote about the vendor field at https://internals.rust-lang.org/t/expand-targets-acceptable-to-rustc/14885/26 👍
Initial people involved
I don't believe this will require a formal "project", just a few PRs, which I'll either write or coordinate. However, I'd like to seek consensus on this change before beginning work on it.
What happens now?
This issue is part of the experimental MCP process described in RFC 2936. Once this issue is filed, a Zulip topic will be opened for discussion, and the lang-team will review open MCPs in its weekly triage meetings. You should receive feedback within a week or two.
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: