Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1efbe7f

Browse files
authored
Unrolled build for rust-lang#137621
Rollup merge of rust-lang#137621 - Berrysoft:cygwin-std, r=joboet Add std support to cygwin target
2 parents 9bad8ac + bd385f3 commit 1efbe7f

File tree

28 files changed

+197
-19
lines changed

28 files changed

+197
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
1818
description: Some("64-bit x86 Cygwin".into()),
1919
tier: Some(3),
2020
host_tools: Some(false),
21-
std: None,
21+
std: Some(true),
2222
},
2323
}
2424
}

library/std/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ fn main() {
6262
|| target_os == "zkvm"
6363
|| target_os == "rtems"
6464
|| target_os == "nuttx"
65+
|| target_os == "cygwin"
6566

6667
// See src/bootstrap/src/core/build_steps/synthetic_targets.rs
6768
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()

library/std/src/os/cygwin/fs.rs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#![stable(feature = "metadata_ext", since = "1.1.0")]
2+
use crate::fs::Metadata;
3+
use crate::sys_common::AsInner;
4+
/// OS-specific extensions to [`fs::Metadata`].
5+
///
6+
/// [`fs::Metadata`]: crate::fs::Metadata
7+
#[stable(feature = "metadata_ext", since = "1.1.0")]
8+
pub trait MetadataExt {
9+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
10+
fn st_dev(&self) -> u64;
11+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
12+
fn st_ino(&self) -> u64;
13+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
14+
fn st_mode(&self) -> u32;
15+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
16+
fn st_nlink(&self) -> u64;
17+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
18+
fn st_uid(&self) -> u32;
19+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
20+
fn st_gid(&self) -> u32;
21+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
22+
fn st_rdev(&self) -> u64;
23+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
24+
fn st_size(&self) -> u64;
25+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
26+
fn st_atime(&self) -> i64;
27+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
28+
fn st_atime_nsec(&self) -> i64;
29+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
30+
fn st_mtime(&self) -> i64;
31+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
32+
fn st_mtime_nsec(&self) -> i64;
33+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
34+
fn st_ctime(&self) -> i64;
35+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
36+
fn st_ctime_nsec(&self) -> i64;
37+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
38+
fn st_blksize(&self) -> u64;
39+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
40+
fn st_blocks(&self) -> u64;
41+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
42+
fn st_birthtime(&self) -> i64;
43+
#[stable(feature = "metadata_ext2", since = "1.8.0")]
44+
fn st_birthtime_nsec(&self) -> i64;
45+
}
46+
#[stable(feature = "metadata_ext", since = "1.1.0")]
47+
impl MetadataExt for Metadata {
48+
fn st_dev(&self) -> u64 {
49+
self.as_inner().as_inner().st_dev as u64
50+
}
51+
fn st_ino(&self) -> u64 {
52+
self.as_inner().as_inner().st_ino as u64
53+
}
54+
fn st_mode(&self) -> u32 {
55+
self.as_inner().as_inner().st_mode as u32
56+
}
57+
fn st_nlink(&self) -> u64 {
58+
self.as_inner().as_inner().st_nlink as u64
59+
}
60+
fn st_uid(&self) -> u32 {
61+
self.as_inner().as_inner().st_uid as u32
62+
}
63+
fn st_gid(&self) -> u32 {
64+
self.as_inner().as_inner().st_gid as u32
65+
}
66+
fn st_rdev(&self) -> u64 {
67+
self.as_inner().as_inner().st_rdev as u64
68+
}
69+
fn st_size(&self) -> u64 {
70+
self.as_inner().as_inner().st_size as u64
71+
}
72+
fn st_atime(&self) -> i64 {
73+
self.as_inner().as_inner().st_atime as i64
74+
}
75+
fn st_atime_nsec(&self) -> i64 {
76+
self.as_inner().as_inner().st_atime_nsec as i64
77+
}
78+
fn st_mtime(&self) -> i64 {
79+
self.as_inner().as_inner().st_mtime as i64
80+
}
81+
fn st_mtime_nsec(&self) -> i64 {
82+
self.as_inner().as_inner().st_mtime_nsec as i64
83+
}
84+
fn st_ctime(&self) -> i64 {
85+
self.as_inner().as_inner().st_ctime as i64
86+
}
87+
fn st_ctime_nsec(&self) -> i64 {
88+
self.as_inner().as_inner().st_ctime_nsec as i64
89+
}
90+
fn st_blksize(&self) -> u64 {
91+
self.as_inner().as_inner().st_blksize as u64
92+
}
93+
fn st_blocks(&self) -> u64 {
94+
self.as_inner().as_inner().st_blocks as u64
95+
}
96+
fn st_birthtime(&self) -> i64 {
97+
self.as_inner().as_inner().st_birthtime as i64
98+
}
99+
fn st_birthtime_nsec(&self) -> i64 {
100+
self.as_inner().as_inner().st_birthtime_nsec as i64
101+
}
102+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//! Cygwin-specific definitions
2+
#![stable(feature = "raw_ext", since = "1.1.0")]
3+
pub mod fs;
4+
pub(crate) mod raw;

library/std/src/os/cygwin/raw.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//! Cygwin-specific raw type definitions.
2+
3+
#[stable(feature = "raw_ext", since = "1.1.0")]
4+
pub use libc::{blkcnt_t, blksize_t, dev_t, ino_t, mode_t, nlink_t, off_t, pthread_t, time_t};

library/std/src/os/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ pub mod windows;
125125
pub mod aix;
126126
#[cfg(target_os = "android")]
127127
pub mod android;
128+
#[cfg(target_os = "cygwin")]
129+
pub mod cygwin;
128130
#[cfg(target_os = "dragonfly")]
129131
pub mod dragonfly;
130132
#[cfg(target_os = "emscripten")]

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ mod platform {
4141
pub use crate::os::aix::*;
4242
#[cfg(target_os = "android")]
4343
pub use crate::os::android::*;
44+
#[cfg(target_os = "cygwin")]
45+
pub use crate::os::cygwin::*;
4446
#[cfg(target_vendor = "apple")]
4547
pub use crate::os::darwin::*;
4648
#[cfg(target_os = "dragonfly")]

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
target_os = "illumos",
1010
target_os = "haiku",
1111
target_os = "nto",
12+
target_os = "cygwin"
1213
))]
1314
use libc::MSG_NOSIGNAL;
1415

@@ -37,6 +38,7 @@ use crate::{fmt, io};
3738
target_os = "illumos",
3839
target_os = "haiku",
3940
target_os = "nto",
41+
target_os = "cygwin"
4042
)))]
4143
const MSG_NOSIGNAL: core::ffi::c_int = 0x0;
4244

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ mod tests;
2121
target_os = "openbsd",
2222
target_os = "nto",
2323
target_vendor = "apple",
24+
target_os = "cygwin"
2425
))]
2526
mod ucred;
2627

@@ -44,6 +45,7 @@ pub use self::stream::*;
4445
target_os = "openbsd",
4546
target_os = "nto",
4647
target_vendor = "apple",
48+
target_os = "cygwin",
4749
))]
4850
#[unstable(feature = "peer_credentials_unix_socket", issue = "42839", reason = "unstable")]
4951
pub use self::ucred::*;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use super::{SocketAncillary, recv_vectored_with_ancillary_from, send_vectored_wi
1010
target_os = "openbsd",
1111
target_os = "nto",
1212
target_vendor = "apple",
13+
target_os = "cygwin"
1314
))]
1415
use super::{UCred, peer_cred};
1516
use crate::fmt;
@@ -231,6 +232,7 @@ impl UnixStream {
231232
target_os = "openbsd",
232233
target_os = "nto",
233234
target_vendor = "apple",
235+
target_os = "cygwin"
234236
))]
235237
pub fn peer_cred(&self) -> io::Result<UCred> {
236238
peer_cred(self)

0 commit comments

Comments
 (0)