Skip to content

Commit 90c59e7

Browse files
authored
Rollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomcc
stdlib support for Apple WatchOS This is a follow-up to #95243 (Add Apple WatchOS compiler targets) that adds stdlib support for Apple WatchOS. `@deg4uss3r` `@nagisa`
2 parents 748cb1f + 439d64a commit 90c59e7

File tree

20 files changed

+75
-29
lines changed

20 files changed

+75
-29
lines changed

library/panic_unwind/src/gcc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const UNWIND_DATA_REG: (i32, i32) = (10, 11); // x10, x11
131131
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
132132

133133
cfg_if::cfg_if! {
134-
if #[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "netbsd")))] {
134+
if #[cfg(all(target_arch = "arm", not(target_os = "ios"), not(target_os = "watchos"), not(target_os = "netbsd")))] {
135135
// ARM EHABI personality routine.
136136
// https://infocenter.arm.com/help/topic/com.arm.doc.ihi0038b/IHI0038B_ehabi.pdf
137137
//

library/std/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn main() {
1515
|| target.contains("illumos")
1616
|| target.contains("apple-darwin")
1717
|| target.contains("apple-ios")
18+
|| target.contains("apple-watchos")
1819
|| target.contains("uwp")
1920
|| target.contains("windows")
2021
|| target.contains("fuchsia")

library/std/src/os/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ pub mod openbsd;
141141
pub mod redox;
142142
#[cfg(target_os = "solaris")]
143143
pub mod solaris;
144-
145144
#[cfg(target_os = "solid_asp3")]
146145
pub mod solid;
147146
#[cfg(target_os = "vxworks")]

library/std/src/os/unix/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pub mod thread;
9090
target_os = "dragonfly",
9191
target_os = "freebsd",
9292
target_os = "ios",
93+
target_os = "watchos",
9394
target_os = "macos",
9495
target_os = "netbsd",
9596
target_os = "openbsd"

library/std/src/os/unix/net/stream.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, Owned
1212
target_os = "freebsd",
1313
target_os = "ios",
1414
target_os = "macos",
15+
target_os = "watchos",
1516
target_os = "netbsd",
1617
target_os = "openbsd"
1718
))]
@@ -30,6 +31,7 @@ use crate::time::Duration;
3031
target_os = "freebsd",
3132
target_os = "ios",
3233
target_os = "macos",
34+
target_os = "watchos",
3335
target_os = "netbsd",
3436
target_os = "openbsd"
3537
))]
@@ -238,6 +240,7 @@ impl UnixStream {
238240
target_os = "freebsd",
239241
target_os = "ios",
240242
target_os = "macos",
243+
target_os = "watchos",
241244
target_os = "netbsd",
242245
target_os = "openbsd"
243246
))]

library/std/src/os/unix/ucred.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub use self::impl_linux::peer_cred;
3636
))]
3737
pub use self::impl_bsd::peer_cred;
3838

39-
#[cfg(any(target_os = "macos", target_os = "ios",))]
39+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
4040
pub use self::impl_mac::peer_cred;
4141

4242
#[cfg(any(target_os = "linux", target_os = "android"))]
@@ -97,7 +97,7 @@ pub mod impl_bsd {
9797
}
9898
}
9999

100-
#[cfg(any(target_os = "macos", target_os = "ios",))]
100+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
101101
pub mod impl_mac {
102102
use super::UCred;
103103
use crate::os::unix::io::AsRawFd;

library/std/src/os/unix/ucred/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use libc::{getegid, geteuid, getpid};
99
target_os = "freebsd",
1010
target_os = "ios",
1111
target_os = "macos",
12+
target_os = "watchos",
1213
target_os = "openbsd"
1314
))]
1415
fn test_socket_pair() {
@@ -25,7 +26,7 @@ fn test_socket_pair() {
2526
}
2627

2728
#[test]
28-
#[cfg(any(target_os = "linux", target_os = "ios", target_os = "macos",))]
29+
#[cfg(any(target_os = "linux", target_os = "ios", target_os = "macos", target_os = "watchos"))]
2930
fn test_socket_pair_pids(arg: Type) -> RetType {
3031
// Create two connected sockets and get their peer credentials.
3132
let (sock_a, sock_b) = UnixStream::pair().unwrap();

library/std/src/sys/unix/args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ mod imp {
151151
}
152152
}
153153

154-
#[cfg(any(target_os = "macos", target_os = "ios"))]
154+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
155155
mod imp {
156156
use super::Args;
157157
use crate::ffi::CStr;
@@ -192,7 +192,7 @@ mod imp {
192192
// for i in (0..[args count])
193193
// res.push([args objectAtIndex:i])
194194
// res
195-
#[cfg(target_os = "ios")]
195+
#[cfg(any(target_os = "ios", target_os = "watchos"))]
196196
pub fn args() -> Args {
197197
use crate::ffi::OsString;
198198
use crate::mem;

library/std/src/sys/unix/env.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ pub mod os {
3131
pub const EXE_EXTENSION: &str = "";
3232
}
3333

34+
#[cfg(target_os = "watchos")]
35+
pub mod os {
36+
pub const FAMILY: &str = "unix";
37+
pub const OS: &str = "watchos";
38+
pub const DLL_PREFIX: &str = "lib";
39+
pub const DLL_SUFFIX: &str = ".dylib";
40+
pub const DLL_EXTENSION: &str = "dylib";
41+
pub const EXE_SUFFIX: &str = "";
42+
pub const EXE_EXTENSION: &str = "";
43+
}
44+
3445
#[cfg(target_os = "freebsd")]
3546
pub mod os {
3647
pub const FAMILY: &str = "unix";

library/std/src/sys/unix/fd.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const READ_LIMIT: usize = libc::ssize_t::MAX as usize;
4747
target_os = "macos",
4848
target_os = "netbsd",
4949
target_os = "openbsd",
50+
target_os = "watchos",
5051
))]
5152
const fn max_iov() -> usize {
5253
libc::IOV_MAX as usize
@@ -67,7 +68,8 @@ const fn max_iov() -> usize {
6768
target_os = "macos",
6869
target_os = "netbsd",
6970
target_os = "openbsd",
70-
target_os = "horizon"
71+
target_os = "horizon",
72+
target_os = "watchos",
7173
)))]
7274
const fn max_iov() -> usize {
7375
16 // The minimum value required by POSIX.

0 commit comments

Comments
 (0)