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
This commit is contained in:
commit
3ec21070e2
6 changed files with 29 additions and 18 deletions
|
@ -867,8 +867,9 @@ fn print_crate_info(
|
|||
DeploymentTarget => {
|
||||
if sess.target.is_like_osx {
|
||||
println_info!(
|
||||
"deployment_target={}",
|
||||
apple::pretty_version(apple::deployment_target(sess))
|
||||
"{}={}",
|
||||
apple::deployment_target_env_var(&sess.target.os),
|
||||
apple::pretty_version(apple::deployment_target(sess)),
|
||||
)
|
||||
} else {
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue