1
Fork 0
rust/compiler/rustc_codegen_ssa/src
Matthias Krüger 3ec21070e2
Rollup merge of #133041 - madsmtm:print-deployment-target-env-var, r=davidtwco
Print name of env var in `--print=deployment-target`

The deployment target environment variable is OS-specific, and if you're in a place where you're asking `rustc` for the deployment target, you're likely to also wanna know the name of the environment variable. I myself wanted this for some code I'm working on in bootstrap, for example.

Behaviour before this PR:
```console
$ rustc --print=deployment-target --target=aarch64-apple-darwin
deployment_target=11.0
$ rustc --print=deployment-target --target=aarch64-apple-visionos
deployment_target=1.0
```

Behaviour after this PR:
```console
$ rustc --print=deployment-target --target=aarch64-apple-darwin
MACOSX_DEPLOYMENT_TARGET=11.0
$ rustc --print=deployment-target --target=aarch64-apple-visionos
XROS_DEPLOYMENT_TARGET=1.0
```

My _belief_ is that this option is extremely rarely used in general, and a GitHub search for "rustc print deployment-target" seems to confirm this, it revealed only the following actual pieces of code using this:
- b292ef6934/src/build_context.rs (L1199-L1220)
- daab9244b0/src/lib.rs (L3422-L3426)

`maturin` does `.split('=').last()`, so it will continue to work after this change, but `cc v1.0.84` did `.strip_prefix("deployment_target=")` since [this PR](https://github.com/rust-lang/cc-rs/pull/848), so it would break. That's _probably_ fine though, it was broken in a lot of scenarios anyway, and [got](https://github.com/rust-lang/cc-rs/pull/901) [reverted](https://github.com/rust-lang/cc-rs/pull/943) in `v1.0.85`.

So while this is _technically_ a breaking change, I really doubt that anyone is going to observe it, so it's probably fine.

``@BlackHoleFox`` wdyt?

``@rustbot`` label O-apple
r? compiler
2024-12-03 07:48:31 +01:00
..
back Rollup merge of #133041 - madsmtm:print-deployment-target-env-var, r=davidtwco 2024-12-03 07:48:31 +01:00
debuginfo use TypingEnv when no infcx is available 2024-11-18 10:38:56 +01:00
mir use stores of the correct size to set discriminants 2024-11-30 18:33:08 +01:00
traits use intra-doc links for CodegenBackend::link 2024-11-27 18:42:14 -06:00
assert_module_sources.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
base.rs additional TypingEnv cleanups 2024-11-19 21:36:23 +01:00
codegen_attrs.rs add a test for target-feature-ABI warnings in closures 2024-11-24 09:20:10 +01:00
common.rs Test fixing raw-dylib 2024-09-24 10:10:31 -07:00
errors.rs Rollup merge of #131405 - davidtwco:hardcoded-strip-macos, r=jieyouxu,albertlarsan68 2024-11-05 23:43:56 +01:00
lib.rs Emit diagnostics for incorrect deployment targets 2024-11-01 17:07:19 +01:00
meth.rs compiler: Directly use rustc_abi in codegen 2024-11-03 12:30:32 -08:00
mono_item.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
size_of_val.rs compiler: Directly use rustc_abi in codegen 2024-11-03 12:30:32 -08:00
target_features.rs mark some target features as 'forbidden' so they cannot be (un)set 2024-11-04 22:56:47 +01:00