From 8c9c8a33dffc524cd91842e94b311baaef231afb Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 18:59:14 +1000 Subject: [PATCH 01/23] Fix parsing of nigthly targets --- src/target/parser.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/target/parser.rs b/src/target/parser.rs index d22cc0e6..89540a68 100644 --- a/src/target/parser.rs +++ b/src/target/parser.rs @@ -266,6 +266,17 @@ impl<'a> TargetInfo<'a> { }); } + if target == "armv7a-vex-v5" { + return Ok(Self { + full_arch: "armv7a", + arch: "arm", + vendor: "vex", + os: "vexos", + env: "v5", + abi: "eabihf", + }); + } + let mut components = target.split('-'); // Insist that the target name contains at least a valid architecture. @@ -340,6 +351,10 @@ impl<'a> TargetInfo<'a> { _ => {} } + if matches!(abi, "macabi" | "sim") { + env = abi; + } + // Extra overrides for badly named targets. match target { // Actually simulator targets. From f6db6fa5e197bd30d89f38469e1d9a50cd33f00c Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:15:32 +1000 Subject: [PATCH 02/23] Fix parser.rs --- src/target/parser.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/target/parser.rs b/src/target/parser.rs index 89540a68..795007ad 100644 --- a/src/target/parser.rs +++ b/src/target/parser.rs @@ -351,10 +351,6 @@ impl<'a> TargetInfo<'a> { _ => {} } - if matches!(abi, "macabi" | "sim") { - env = abi; - } - // Extra overrides for badly named targets. match target { // Actually simulator targets. @@ -437,6 +433,10 @@ impl<'a> TargetInfo<'a> { abi = "elfv2"; } + if env == "" && matches!(abi, "macabi" | "sim") { + env = abi; + } + Ok(Self { full_arch, arch, From 2d40e9a1bccc456a32623ca77267237525fe9adf Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:17:53 +1000 Subject: [PATCH 03/23] Fix clippy in parser.rs --- src/target/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/parser.rs b/src/target/parser.rs index 795007ad..64d274fc 100644 --- a/src/target/parser.rs +++ b/src/target/parser.rs @@ -433,7 +433,7 @@ impl<'a> TargetInfo<'a> { abi = "elfv2"; } - if env == "" && matches!(abi, "macabi" | "sim") { + if env.is_empty() && matches!(abi, "macabi" | "sim") { env = abi; } From ac045b60692931ef3bbdebc88a5e0ca498cbaae8 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:19:28 +1000 Subject: [PATCH 04/23] Fix fmt in parser.rs --- src/target/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/parser.rs b/src/target/parser.rs index 64d274fc..e79a97cf 100644 --- a/src/target/parser.rs +++ b/src/target/parser.rs @@ -436,7 +436,7 @@ impl<'a> TargetInfo<'a> { if env.is_empty() && matches!(abi, "macabi" | "sim") { env = abi; } - + Ok(Self { full_arch, arch, From 110e07563254757df78c694a6ad2b521e9c002db Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:21:24 +1000 Subject: [PATCH 05/23] Fix fmt in parser.rs --- src/target/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/parser.rs b/src/target/parser.rs index e79a97cf..a80a324c 100644 --- a/src/target/parser.rs +++ b/src/target/parser.rs @@ -436,7 +436,7 @@ impl<'a> TargetInfo<'a> { if env.is_empty() && matches!(abi, "macabi" | "sim") { env = abi; } - + Ok(Self { full_arch, arch, From 0866403edd0df50c53227f26257b531631562f14 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 19:32:48 +1000 Subject: [PATCH 06/23] Fix parser.rs without breaking teats --- src/target/parser.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/target/parser.rs b/src/target/parser.rs index a80a324c..b4b3e2dd 100644 --- a/src/target/parser.rs +++ b/src/target/parser.rs @@ -433,10 +433,6 @@ impl<'a> TargetInfo<'a> { abi = "elfv2"; } - if env.is_empty() && matches!(abi, "macabi" | "sim") { - env = abi; - } - Ok(Self { full_arch, arch, @@ -544,6 +540,10 @@ mod tests { } } + if matches!(target.env, "macabi" | "sim") { + target.env = ""; + } + target } From 90ce59238cc17907c105b43918219841e881a5ef Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:17:06 +1000 Subject: [PATCH 07/23] Fix parser.rs --- src/target/parser.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/target/parser.rs b/src/target/parser.rs index b4b3e2dd..74bd16d3 100644 --- a/src/target/parser.rs +++ b/src/target/parser.rs @@ -232,8 +232,8 @@ fn parse_envabi(last_component: &str) -> Option<(&str, &str)> { "abiv2" => ("", "spe"), "eabi" => ("", "eabi"), "eabihf" => ("", "eabihf"), - "macabi" => ("", "macabi"), - "sim" => ("", "sim"), + "macabi" => ("macabi", ""), + "sim" => ("sim", ""), "softfloat" => ("", "softfloat"), "spe" => ("", "spe"), "x32" => ("", "x32"), @@ -355,7 +355,7 @@ impl<'a> TargetInfo<'a> { match target { // Actually simulator targets. "i386-apple-ios" | "x86_64-apple-ios" | "x86_64-apple-tvos" => { - abi = "sim"; + env = "sim"; } // Name should've contained `muslabi64`. "mips64-openwrt-linux-musl" => { @@ -540,8 +540,8 @@ mod tests { } } - if matches!(target.env, "macabi" | "sim") { - target.env = ""; + if matches!(target.abi, "macabi" | "sim") { + target.abi = ""; } target From 3475af60b4627c982f8e16472e6b18bfdcb61a94 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:18:39 +1000 Subject: [PATCH 08/23] Fux apple.rs --- src/target/apple.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/target/apple.rs b/src/target/apple.rs index bd65e00f..0c8b8e04 100644 --- a/src/target/apple.rs +++ b/src/target/apple.rs @@ -1,8 +1,16 @@ use super::TargetInfo; impl TargetInfo<'_> { + fn env_or_abi(&self) -> str { + if !self.env.is_empty() { + self.env + } else { + self.abi + } + } + pub(crate) fn apple_sdk_name(&self) -> &'static str { - match (self.os, self.abi) { + match (self.os, self.env_or_abi()) { ("macos", "") => "macosx", ("ios", "") => "iphoneos", ("ios", "sim") => "iphonesimulator", @@ -30,7 +38,7 @@ impl TargetInfo<'_> { // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mmacos-version-min // https://clang.llvm.org/docs/AttributeReference.html#availability // https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html#index-mmacosx-version-min - match (self.os, self.abi) { + match (self.os, self.env_or_abi()) { ("macos", "") => format!("-mmacosx-version-min={min_version}"), ("ios", "") => format!("-miphoneos-version-min={min_version}"), ("ios", "sim") => format!("-mios-simulator-version-min={min_version}"), From 8b27312289d1a6fa8ed325d120960af9d87fb3f1 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:20:25 +1000 Subject: [PATCH 09/23] Fix apple.rs --- src/target/apple.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/apple.rs b/src/target/apple.rs index 0c8b8e04..3249222e 100644 --- a/src/target/apple.rs +++ b/src/target/apple.rs @@ -1,7 +1,7 @@ use super::TargetInfo; impl TargetInfo<'_> { - fn env_or_abi(&self) -> str { + fn env_or_abi(&self) -> &str { if !self.env.is_empty() { self.env } else { From 9df789accf2ddfe0d9b2f642a1a357ce99d6de51 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:29:31 +1000 Subject: [PATCH 10/23] Make TargetInfo::env_or_abi a pub(crste) fn --- src/target/apple.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/apple.rs b/src/target/apple.rs index 3249222e..7e05b473 100644 --- a/src/target/apple.rs +++ b/src/target/apple.rs @@ -1,7 +1,7 @@ use super::TargetInfo; impl TargetInfo<'_> { - fn env_or_abi(&self) -> &str { + pub(crate) fn env_or_abi(&self) -> &str { if !self.env.is_empty() { self.env } else { From 787800fe3086b0ad17a5f2ef552fecd3368d3881 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:41:43 +1000 Subject: [PATCH 11/23] Replace env_or_abi with get_apple_env --- src/target/apple.rs | 60 +++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/src/target/apple.rs b/src/target/apple.rs index 7e05b473..e2f9d737 100644 --- a/src/target/apple.rs +++ b/src/target/apple.rs @@ -1,26 +1,32 @@ use super::TargetInfo; +#[derive(Copy, Clone, Debug)] +pub(crate) enum AppleEnv { + Simulator, + MacCatalyst, +} +use AppleEnv::*; + impl TargetInfo<'_> { - pub(crate) fn env_or_abi(&self) -> &str { - if !self.env.is_empty() { - self.env - } else { - self.abi + pub(crate) fn get_apple_env(&self) -> Option { + match (self.env, self.abi) { + ("sim", _) | (_, "sim") => Some(Simulator), + ("macabi", _) | (_, "macabi") => Some(MacCatalyst), } } pub(crate) fn apple_sdk_name(&self) -> &'static str { - match (self.os, self.env_or_abi()) { - ("macos", "") => "macosx", - ("ios", "") => "iphoneos", - ("ios", "sim") => "iphonesimulator", - ("ios", "macabi") => "macosx", - ("tvos", "") => "appletvos", - ("tvos", "sim") => "appletvsimulator", - ("watchos", "") => "watchos", - ("watchos", "sim") => "watchsimulator", - ("visionos", "") => "xros", - ("visionos", "sim") => "xrsimulator", + match (self.os, self.get_apple_env()) { + ("macos", None) => "macosx", + ("ios", None) => "iphoneos", + ("ios", Some(Simulator)) => "iphonesimulator", + ("ios", Some(MacCatalyst)) => "macosx", + ("tvos", None) => "appletvos", + ("tvos", Some(Simulator)) => "appletvsimulator", + ("watchos", None) => "watchos", + ("watchos", Some(Simulator)) => "watchsimulator", + ("visionos", None) => "xros", + ("visionos", Some(Simulator)) => "xrsimulator", (os, _) => panic!("invalid Apple target OS {}", os), } } @@ -38,19 +44,19 @@ impl TargetInfo<'_> { // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mmacos-version-min // https://clang.llvm.org/docs/AttributeReference.html#availability // https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html#index-mmacosx-version-min - match (self.os, self.env_or_abi()) { - ("macos", "") => format!("-mmacosx-version-min={min_version}"), - ("ios", "") => format!("-miphoneos-version-min={min_version}"), - ("ios", "sim") => format!("-mios-simulator-version-min={min_version}"), - ("ios", "macabi") => format!("-mtargetos=ios{min_version}-macabi"), - ("tvos", "") => format!("-mappletvos-version-min={min_version}"), - ("tvos", "sim") => format!("-mappletvsimulator-version-min={min_version}"), - ("watchos", "") => format!("-mwatchos-version-min={min_version}"), - ("watchos", "sim") => format!("-mwatchsimulator-version-min={min_version}"), + match (self.os, self.get_apple_env()) { + ("macos", None) => format!("-mmacosx-version-min={min_version}"), + ("ios", None) => format!("-miphoneos-version-min={min_version}"), + ("ios", Some(Simulator)) => format!("-mios-simulator-version-min={min_version}"), + ("ios", Some(MacCatalyst)) => format!("-mtargetos=ios{min_version}-macabi"), + ("tvos", None) => format!("-mappletvos-version-min={min_version}"), + ("tvos", Some(Simulator)) => format!("-mappletvsimulator-version-min={min_version}"), + ("watchos", None) => format!("-mwatchos-version-min={min_version}"), + ("watchos", Some(Simulator)) => format!("-mwatchsimulator-version-min={min_version}"), // `-mxros-version-min` does not exist // https://github.com/llvm/llvm-project/issues/88271 - ("visionos", "") => format!("-mtargetos=xros{min_version}"), - ("visionos", "sim") => format!("-mtargetos=xros{min_version}-simulator"), + ("visionos", None) => format!("-mtargetos=xros{min_version}"), + ("visionos", Some(Simulator)) => format!("-mtargetos=xros{min_version}-simulator"), (os, _) => panic!("invalid Apple target OS {}", os), } } From 7c6fe1f2714090e289a3b54a4920ebdd6e22f329 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:42:18 +1000 Subject: [PATCH 12/23] Export AppleEnv from target/apple --- src/target.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/target.rs b/src/target.rs index ed432df5..76786944 100644 --- a/src/target.rs +++ b/src/target.rs @@ -7,6 +7,7 @@ mod llvm; mod parser; pub(crate) use parser::TargetInfoParser; +pub(crate) use apple::*; /// Information specific to a `rustc` target. /// From d509606a7e24ec9efe0845f4ced374da759184b3 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:45:13 +1000 Subject: [PATCH 13/23] Fix lib.rs to use TargetInfo::get_apple_env --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2da9a3c9..224f6c6d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -262,7 +262,7 @@ use shlex::Shlex; mod parallel; mod target; mod windows; -use self::target::TargetInfo; +use self::target::*;; // Regardless of whether this should be in this crate's public API, // it has been since 2015, so don't break it. pub use windows::find_tools as windows_registry; @@ -2791,7 +2791,7 @@ impl Build { // https://github.com/llvm/llvm-project/issues/88271 // And the workaround to use `-mtargetos=` cannot be used with the `--target` flag that we // otherwise specify. So we avoid emitting that, and put the version in `--target` instead. - if cmd.is_like_gnu() || !(target.os == "visionos" || target.abi == "macabi") { + if cmd.is_like_gnu() || !(target.os == "visionos" || target.get_apple_env() == Some(MacCatalyst)) { let min_version = self.apple_deployment_target(&target); cmd.args .push(target.apple_version_flag(&min_version).into()); @@ -2811,7 +2811,7 @@ impl Build { cmd.env .push(("SDKROOT".into(), OsStr::new(&sdk_path).to_owned())); - if target.abi == "macabi" { + if target.get_apple_env() == Some(MacCatalyst) { // Mac Catalyst uses the macOS SDK, but to compile against and // link to iOS-specific frameworks, we should have the support // library stubs in the include and library search path. From 27025b5443d415370aeeb59a271e0f6cd7f67df0 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:46:48 +1000 Subject: [PATCH 14/23] Fix lib.rs --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 224f6c6d..3cc0c64b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2301,7 +2301,7 @@ impl Build { // So instead, we pass the deployment target with `-m*-version-min=`, and only // pass it here on visionOS and Mac Catalyst where that option does not exist: // https://github.com/rust-lang/cc-rs/issues/1383 - let version = if target.os == "visionos" || target.abi == "macabi" { + let version = if target.os == "visionos" || target.get_apple_env == Some(MacCatalyst) { Some(self.apple_deployment_target(target)) } else { None From 8a70e47cf9f3888dffb41242b9be9e209fc617a1 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:49:53 +1000 Subject: [PATCH 15/23] Derive Eq for AppleEnv --- src/target/apple.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/apple.rs b/src/target/apple.rs index e2f9d737..43271fd7 100644 --- a/src/target/apple.rs +++ b/src/target/apple.rs @@ -1,6 +1,6 @@ use super::TargetInfo; -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub(crate) enum AppleEnv { Simulator, MacCatalyst, From 4fd3cb8c001d47585e972b361f1b14a87bcc60f8 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:51:10 +1000 Subject: [PATCH 16/23] Fix get_apple_env --- src/target/apple.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/target/apple.rs b/src/target/apple.rs index 43271fd7..555488de 100644 --- a/src/target/apple.rs +++ b/src/target/apple.rs @@ -12,6 +12,7 @@ impl TargetInfo<'_> { match (self.env, self.abi) { ("sim", _) | (_, "sim") => Some(Simulator), ("macabi", _) | (_, "macabi") => Some(MacCatalyst), + _ => None, } } From 988761a5765b5b59fad795984ef2c097ed7501f7 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 20:53:11 +1000 Subject: [PATCH 17/23] Fix lib.rs --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3cc0c64b..5029ce2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -262,7 +262,7 @@ use shlex::Shlex; mod parallel; mod target; mod windows; -use self::target::*;; +use self::target::*; // Regardless of whether this should be in this crate's public API, // it has been since 2015, so don't break it. pub use windows::find_tools as windows_registry; @@ -2301,7 +2301,7 @@ impl Build { // So instead, we pass the deployment target with `-m*-version-min=`, and only // pass it here on visionOS and Mac Catalyst where that option does not exist: // https://github.com/rust-lang/cc-rs/issues/1383 - let version = if target.os == "visionos" || target.get_apple_env == Some(MacCatalyst) { + let version = if target.os == "visionos" || target.get_apple_env() == Some(MacCatalyst) { Some(self.apple_deployment_target(target)) } else { None From 02f1b69c19642fe0aec52d9cb211ef24d7fbe123 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 21:04:18 +1000 Subject: [PATCH 18/23] Mark AppleEnv::* as pub(crate) --- src/target/apple.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/apple.rs b/src/target/apple.rs index 555488de..8db8fb59 100644 --- a/src/target/apple.rs +++ b/src/target/apple.rs @@ -5,7 +5,7 @@ pub(crate) enum AppleEnv { Simulator, MacCatalyst, } -use AppleEnv::*; +pub(crate) use AppleEnv::*; impl TargetInfo<'_> { pub(crate) fn get_apple_env(&self) -> Option { From 2ee829021cd87a7b2a4fd25e1aa1e21b469a099c Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 21:49:12 +1000 Subject: [PATCH 19/23] Fix llvm.rs --- src/target/llvm.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/target/llvm.rs b/src/target/llvm.rs index 124ab2a0..e828c598 100644 --- a/src/target/llvm.rs +++ b/src/target/llvm.rs @@ -91,9 +91,10 @@ impl TargetInfo<'_> { let env = match self.env { "newlib" | "nto70" | "nto71" | "nto71_iosock" | "p1" | "p2" | "relibc" | "sgx" | "uclibc" => "", + "sim" => "simulator", env => env, }; - let abi = match self.abi { + let mut abi = match self.abi { "sim" => "simulator", "llvm" | "softfloat" | "uwp" | "vec-extabi" => "", "ilp32" => "_ilp32", From b0c975d535a5621f58c73c7b1ee42db940d23a5d Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 21:56:33 +1000 Subject: [PATCH 20/23] Fix llvm.rs --- src/target/llvm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target/llvm.rs b/src/target/llvm.rs index e828c598..63b0dfca 100644 --- a/src/target/llvm.rs +++ b/src/target/llvm.rs @@ -94,7 +94,7 @@ impl TargetInfo<'_> { "sim" => "simulator", env => env, }; - let mut abi = match self.abi { + let abi = match self.abi { "sim" => "simulator", "llvm" | "softfloat" | "uwp" | "vec-extabi" => "", "ilp32" => "_ilp32", From 7d40f50d430983e76f91a455814166f1c2c552c5 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 22:15:20 +1000 Subject: [PATCH 21/23] Fix fmt in lib.rs --- src/lib.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5029ce2d..6c41d3e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2301,11 +2301,12 @@ impl Build { // So instead, we pass the deployment target with `-m*-version-min=`, and only // pass it here on visionOS and Mac Catalyst where that option does not exist: // https://github.com/rust-lang/cc-rs/issues/1383 - let version = if target.os == "visionos" || target.get_apple_env() == Some(MacCatalyst) { - Some(self.apple_deployment_target(target)) - } else { - None - }; + let version = + if target.os == "visionos" || target.get_apple_env() == Some(MacCatalyst) { + Some(self.apple_deployment_target(target)) + } else { + None + }; let clang_target = target.llvm_target(&self.get_raw_target()?, version.as_deref()); @@ -2791,7 +2792,9 @@ impl Build { // https://github.com/llvm/llvm-project/issues/88271 // And the workaround to use `-mtargetos=` cannot be used with the `--target` flag that we // otherwise specify. So we avoid emitting that, and put the version in `--target` instead. - if cmd.is_like_gnu() || !(target.os == "visionos" || target.get_apple_env() == Some(MacCatalyst)) { + if cmd.is_like_gnu() + || !(target.os == "visionos" || target.get_apple_env() == Some(MacCatalyst)) + { let min_version = self.apple_deployment_target(&target); cmd.args .push(target.apple_version_flag(&min_version).into()); From d97f0d24498b9c6d21e8b8f45a833786d9f78fb5 Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 22:20:08 +1000 Subject: [PATCH 22/23] add extra assert to target_from_rustc_cfgs --- src/target/parser.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/target/parser.rs b/src/target/parser.rs index 74bd16d3..4bcf7043 100644 --- a/src/target/parser.rs +++ b/src/target/parser.rs @@ -541,6 +541,7 @@ mod tests { } if matches!(target.abi, "macabi" | "sim") { + assert_eq!(target.env, target.abi); target.abi = ""; } From a53b3fdddb9c4edd3bf5a823a9324e349328e22a Mon Sep 17 00:00:00 2001 From: Jiahao XU <30436523+NobodyXu@users.noreply.github.com> Date: Mon, 11 Aug 2025 22:20:49 +1000 Subject: [PATCH 23/23] Fix fmt in target.rs Fix import order, sort them --- src/target.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/target.rs b/src/target.rs index 76786944..16832678 100644 --- a/src/target.rs +++ b/src/target.rs @@ -6,8 +6,8 @@ mod generated; mod llvm; mod parser; -pub(crate) use parser::TargetInfoParser; pub(crate) use apple::*; +pub(crate) use parser::TargetInfoParser; /// Information specific to a `rustc` target. ///