Skip to content

Commit f407a01

Browse files
committed
fixup! rustc_target: introduce Os
1 parent c316964 commit f407a01

33 files changed

+57
-57
lines changed

compiler/rustc_codegen_ssa/src/back/apple.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ mod tests;
1919
pub(super) fn sdk_name(target: &Target) -> &'static str {
2020
match (&target.os, &target.env) {
2121
(Os::MacOs, Env::Unspecified) => "MacOSX",
22-
(Os::Ios, Env::Unspecified) => "iPhoneOS",
23-
(Os::Ios, Env::Sim) => "iPhoneSimulator",
22+
(Os::IOs, Env::Unspecified) => "iPhoneOS",
23+
(Os::IOs, Env::Sim) => "iPhoneSimulator",
2424
// Mac Catalyst uses the macOS SDK
25-
(Os::Ios, Env::MacAbi) => "MacOSX",
26-
(Os::Tvos, Env::Unspecified) => "AppleTVOS",
27-
(Os::Tvos, Env::Sim) => "AppleTVSimulator",
25+
(Os::IOs, Env::MacAbi) => "MacOSX",
26+
(Os::TvOs, Env::Unspecified) => "AppleTVOS",
27+
(Os::TvOs, Env::Sim) => "AppleTVSimulator",
2828
(Os::VisionOs, Env::Unspecified) => "XROS",
2929
(Os::VisionOs, Env::Sim) => "XRSimulator",
3030
(Os::WatchOs, Env::Unspecified) => "WatchOS",
@@ -36,13 +36,13 @@ pub(super) fn sdk_name(target: &Target) -> &'static str {
3636
pub(super) fn macho_platform(target: &Target) -> u32 {
3737
match (&target.os, &target.env) {
3838
(Os::MacOs, _) => object::macho::PLATFORM_MACOS,
39-
(Os::Ios, Env::MacAbi) => object::macho::PLATFORM_MACCATALYST,
40-
(Os::Ios, Env::Sim) => object::macho::PLATFORM_IOSSIMULATOR,
41-
(Os::Ios, _) => object::macho::PLATFORM_IOS,
39+
(Os::IOs, Env::MacAbi) => object::macho::PLATFORM_MACCATALYST,
40+
(Os::IOs, Env::Sim) => object::macho::PLATFORM_IOSSIMULATOR,
41+
(Os::IOs, _) => object::macho::PLATFORM_IOS,
4242
(Os::WatchOs, Env::Sim) => object::macho::PLATFORM_WATCHOSSIMULATOR,
4343
(Os::WatchOs, _) => object::macho::PLATFORM_WATCHOS,
44-
(Os::Tvos, Env::Sim) => object::macho::PLATFORM_TVOSSIMULATOR,
45-
(Os::Tvos, _) => object::macho::PLATFORM_TVOS,
44+
(Os::TvOs, Env::Sim) => object::macho::PLATFORM_TVOSSIMULATOR,
45+
(Os::TvOs, _) => object::macho::PLATFORM_TVOS,
4646
(Os::VisionOs, Env::Sim) => object::macho::PLATFORM_XROSSIMULATOR,
4747
(Os::VisionOs, _) => object::macho::PLATFORM_XROS,
4848
(os, env) => unreachable!("invalid os '{os}' / env '{env}' combination for Apple target"),

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,9 +3125,9 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
31253125
// > - driverkit
31263126
let platform_name = match (target_os, target_env) {
31273127
(os, Env::Unspecified) => os.desc(),
3128-
(Os::Ios, Env::MacAbi) => "mac-catalyst",
3129-
(Os::Ios, Env::Sim) => "ios-simulator",
3130-
(Os::Tvos, Env::Sim) => "tvos-simulator",
3128+
(Os::IOs, Env::MacAbi) => "mac-catalyst",
3129+
(Os::IOs, Env::Sim) => "ios-simulator",
3130+
(Os::TvOs, Env::Sim) => "tvos-simulator",
31313131
(Os::WatchOs, Env::Sim) => "watchos-simulator",
31323132
(Os::VisionOs, Env::Sim) => "visionos-simulator",
31333133
_ => bug!("invalid OS/env combination for Apple target: {target_os}, {target_env}"),

compiler/rustc_target/src/spec/base/apple/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ fn unversioned_llvm_target(os: &Os, arch: Arch, env: TargetEnv) -> StaticCow<str
212212
// https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L236-L282
213213
let os = match os {
214214
Os::MacOs => "macosx",
215-
Os::Ios => "ios",
215+
Os::IOs => "ios",
216216
Os::WatchOs => "watchos",
217-
Os::Tvos => "tvos",
217+
Os::TvOs => "tvos",
218218
Os::VisionOs => "xros",
219219
_ => unreachable!("tried to get LLVM target OS for non-Apple platform"),
220220
};
@@ -304,8 +304,8 @@ impl OSVersion {
304304
// ```
305305
let (major, minor, patch) = match os {
306306
Os::MacOs => (10, 12, 0),
307-
Os::Ios => (10, 0, 0),
308-
Os::Tvos => (10, 0, 0),
307+
Os::IOs => (10, 0, 0),
308+
Os::TvOs => (10, 0, 0),
309309
Os::WatchOs => (5, 0, 0),
310310
Os::VisionOs => (1, 0, 0),
311311
other => {
@@ -325,12 +325,12 @@ impl OSVersion {
325325
pub fn minimum_deployment_target(target: &Target) -> Self {
326326
let (major, minor, patch) = match (&target.os, &target.arch, &target.env) {
327327
(Os::MacOs, crate::spec::Arch::AArch64, _) => (11, 0, 0),
328-
(Os::Ios, crate::spec::Arch::AArch64, Env::MacAbi) => (14, 0, 0),
329-
(Os::Ios, crate::spec::Arch::AArch64, Env::Sim) => (14, 0, 0),
330-
(Os::Ios, _, _) if target.llvm_target.starts_with("arm64e") => (14, 0, 0),
328+
(Os::IOs, crate::spec::Arch::AArch64, Env::MacAbi) => (14, 0, 0),
329+
(Os::IOs, crate::spec::Arch::AArch64, Env::Sim) => (14, 0, 0),
330+
(Os::IOs, _, _) if target.llvm_target.starts_with("arm64e") => (14, 0, 0),
331331
// Mac Catalyst defaults to 13.1 in Clang.
332-
(Os::Ios, _, Env::MacAbi) => (13, 1, 0),
333-
(Os::Tvos, crate::spec::Arch::AArch64, Env::Sim) => (14, 0, 0),
332+
(Os::IOs, _, Env::MacAbi) => (13, 1, 0),
333+
(Os::TvOs, crate::spec::Arch::AArch64, Env::Sim) => (14, 0, 0),
334334
(Os::WatchOs, crate::spec::Arch::AArch64, Env::Sim) => (7, 0, 0),
335335
// True Aarch64 on watchOS (instead of their Aarch64 Ilp32 called `arm64_32`) has been
336336
// available since Xcode 14, but it's only actually used more recently in watchOS 26.
@@ -349,9 +349,9 @@ impl OSVersion {
349349
pub fn deployment_target_env_var(os: &Os) -> &'static str {
350350
match os {
351351
Os::MacOs => "MACOSX_DEPLOYMENT_TARGET",
352-
Os::Ios => "IPHONEOS_DEPLOYMENT_TARGET",
352+
Os::IOs => "IPHONEOS_DEPLOYMENT_TARGET",
353353
Os::WatchOs => "WATCHOS_DEPLOYMENT_TARGET",
354-
Os::Tvos => "TVOS_DEPLOYMENT_TARGET",
354+
Os::TvOs => "TVOS_DEPLOYMENT_TARGET",
355355
Os::VisionOs => "XROS_DEPLOYMENT_TARGET",
356356
_ => unreachable!("tried to get deployment target env var for non-Apple platform"),
357357
}

compiler/rustc_target/src/spec/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,7 @@ crate::target_spec_enum! {
19481948
Horizon = "horizon",
19491949
Hurd = "hurd",
19501950
Illumos = "illumos",
1951+
IOs = "ios",
19511952
L4Re = "l4re",
19521953
Linux = "linux",
19531954
LynxOs178 = "lynxos178",
@@ -1957,17 +1958,17 @@ crate::target_spec_enum! {
19571958
NetBsd = "netbsd",
19581959
None = "none",
19591960
Nto = "nto",
1960-
Nuttx = "nuttx",
1961+
NuttX = "nuttx",
19611962
OpenBsd = "openbsd",
1962-
Psx = "psx",
19631963
Psp = "psp",
1964+
Psx = "psx",
19641965
Redox = "redox",
19651966
Rtems = "rtems",
19661967
Solaris = "solaris",
19671968
SolidAsp3 = "solid_asp3",
19681969
TeeOs = "teeos",
19691970
Trusty = "trusty",
1970-
Tvos = "tvos",
1971+
TvOs = "tvos",
19711972
Uefi = "uefi",
19721973
VexOs = "vexos",
19731974
VisionOs = "visionos",
@@ -1978,7 +1979,6 @@ crate::target_spec_enum! {
19781979
Windows = "windows",
19791980
Xous = "xous",
19801981
Zkvm = "zkvm",
1981-
Ios = "ios",
19821982
Unknown = "unknown",
19831983
}
19841984
/// The vast majority of the time, the compiler deals with a fixed set of

compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::spec::base::apple::{Arch, TargetEnv, base};
22
use crate::spec::{Os, SanitizerSet, Target, TargetMetadata, TargetOptions};
33

44
pub(crate) fn target() -> Target {
5-
let (opts, llvm_target, arch) = base(Os::Ios, Arch::Arm64, TargetEnv::Normal);
5+
let (opts, llvm_target, arch) = base(Os::IOs, Arch::Arm64, TargetEnv::Normal);
66
Target {
77
llvm_target,
88
metadata: TargetMetadata {

compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::spec::base::apple::{Arch, TargetEnv, base};
22
use crate::spec::{Os, SanitizerSet, Target, TargetMetadata, TargetOptions};
33

44
pub(crate) fn target() -> Target {
5-
let (opts, llvm_target, arch) = base(Os::Ios, Arch::Arm64, TargetEnv::MacCatalyst);
5+
let (opts, llvm_target, arch) = base(Os::IOs, Arch::Arm64, TargetEnv::MacCatalyst);
66
Target {
77
llvm_target,
88
metadata: TargetMetadata {

compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::spec::base::apple::{Arch, TargetEnv, base};
22
use crate::spec::{Os, SanitizerSet, Target, TargetMetadata, TargetOptions};
33

44
pub(crate) fn target() -> Target {
5-
let (opts, llvm_target, arch) = base(Os::Ios, Arch::Arm64, TargetEnv::Simulator);
5+
let (opts, llvm_target, arch) = base(Os::IOs, Arch::Arm64, TargetEnv::Simulator);
66
Target {
77
llvm_target,
88
metadata: TargetMetadata {

compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::spec::base::apple::{Arch, TargetEnv, base};
22
use crate::spec::{Os, Target, TargetMetadata, TargetOptions};
33

44
pub(crate) fn target() -> Target {
5-
let (opts, llvm_target, arch) = base(Os::Tvos, Arch::Arm64, TargetEnv::Normal);
5+
let (opts, llvm_target, arch) = base(Os::TvOs, Arch::Arm64, TargetEnv::Normal);
66
Target {
77
llvm_target,
88
metadata: TargetMetadata {

compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::spec::base::apple::{Arch, TargetEnv, base};
22
use crate::spec::{Os, Target, TargetMetadata, TargetOptions};
33

44
pub(crate) fn target() -> Target {
5-
let (opts, llvm_target, arch) = base(Os::Tvos, Arch::Arm64, TargetEnv::Simulator);
5+
let (opts, llvm_target, arch) = base(Os::TvOs, Arch::Arm64, TargetEnv::Simulator);
66
Target {
77
llvm_target,
88
metadata: TargetMetadata {

compiler/rustc_target/src/spec/targets/aarch64_unknown_nuttx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) fn target() -> Target {
2828
stack_probes: StackProbeType::Inline,
2929
panic_strategy: PanicStrategy::Abort,
3030
families: cvs!["unix"],
31-
os: Os::Nuttx,
31+
os: Os::NuttX,
3232
..Default::default()
3333
};
3434
Target {

0 commit comments

Comments
 (0)