Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcfb0556

Browse files
committed
Merge Applestd::os extensions modules intostd::os::darwin
The functionality available on Apple platforms are very similar, andwere duplicated for each platform.Additionally, this fixes a warning when compiling the standard libraryfor tvOS, watchOS and visionOS by marking the corresponding code asdead code.
1 parent12ec5b7 commitcfb0556

File tree

16 files changed

+86
-797
lines changed

16 files changed

+86
-797
lines changed

‎std/src/fs/tests.rs‎

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,16 +1638,8 @@ fn rename_directory() {
16381638

16391639
#[test]
16401640
fntest_file_times(){
1641-
#[cfg(target_os ="ios")]
1642-
usecrate::os::ios::fs::FileTimesExt;
1643-
#[cfg(target_os ="macos")]
1644-
usecrate::os::macos::fs::FileTimesExt;
1645-
#[cfg(target_os ="tvos")]
1646-
usecrate::os::tvos::fs::FileTimesExt;
1647-
#[cfg(target_os ="visionos")]
1648-
usecrate::os::visionos::fs::FileTimesExt;
1649-
#[cfg(target_os ="watchos")]
1650-
usecrate::os::watchos::fs::FileTimesExt;
1641+
#[cfg(target_vendor ="apple")]
1642+
usecrate::os::darwin::fs::FileTimesExt;
16511643
#[cfg(windows)]
16521644
usecrate::os::windows::fs::FileTimesExt;
16531645

@@ -1693,16 +1685,7 @@ fn test_file_times() {
16931685
#[test]
16941686
#[cfg(target_vendor ="apple")]
16951687
fntest_file_times_pre_epoch_with_nanos(){
1696-
#[cfg(target_os ="ios")]
1697-
usecrate::os::ios::fs::FileTimesExt;
1698-
#[cfg(target_os ="macos")]
1699-
usecrate::os::macos::fs::FileTimesExt;
1700-
#[cfg(target_os ="tvos")]
1701-
usecrate::os::tvos::fs::FileTimesExt;
1702-
#[cfg(target_os ="visionos")]
1703-
usecrate::os::visionos::fs::FileTimesExt;
1704-
#[cfg(target_os ="watchos")]
1705-
usecrate::os::watchos::fs::FileTimesExt;
1688+
usecrate::os::darwin::fs::FileTimesExt;
17061689

17071690
let tmp =tmpdir();
17081691
let file =File::create(tmp.join("foo")).unwrap();

‎std/src/os/macos/fs.rs‎renamed to ‎std/src/os/darwin/fs.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#![stable(feature ="metadata_ext", since ="1.1.0")]
1+
#![allow(dead_code)]
22

33
usecrate::fs::{self,Metadata};
44
usecrate::sealed::Sealed;
55
usecrate::sys_common::{AsInner,AsInnerMut,IntoInner};
66
usecrate::time::SystemTime;
77

88
#[allow(deprecated)]
9-
usecrate::os::macos::raw;
9+
usesuper::raw;
1010

1111
/// OS-specific extensions to [`fs::Metadata`].
1212
///
@@ -70,6 +70,7 @@ pub trait MetadataExt {
7070
fnst_gen(&self) ->u32;
7171
#[stable(feature ="metadata_ext2", since ="1.8.0")]
7272
fnst_lspare(&self) ->u32;
73+
#[cfg(target_os ="macos")]
7374
#[stable(feature ="metadata_ext2", since ="1.8.0")]
7475
fnst_qspare(&self) ->[u64;2];
7576
}
@@ -143,6 +144,7 @@ impl MetadataExt for Metadata {
143144
fnst_lspare(&self) ->u32{
144145
self.as_inner().as_inner().st_lspareasu32
145146
}
147+
#[cfg(target_os ="macos")]
146148
fnst_qspare(&self) ->[u64;2]{
147149
let qspare =self.as_inner().as_inner().st_qspare;
148150
[qspare[0]asu64, qspare[1]asu64]

‎std/src/os/darwin/mod.rs‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//! Platform-specific extensions to `std` for Darwin / Apple platforms.
2+
//!
3+
//! This is available on the following operating systems:
4+
//! - macOS
5+
//! - iOS
6+
//! - tvOS
7+
//! - watchOS
8+
//! - visionOS
9+
//!
10+
//! Note: This module is called "Darwin" as that's the name of the underlying
11+
//! core OS of the above operating systems, but it should not be confused with
12+
//! the `-darwin` suffix in the `x86_64-apple-darwin` and
13+
//! `aarch64-apple-darwin` target names, which are mostly named that way for
14+
//! legacy reasons.
15+
16+
pub(crate)mod fs;
17+
// deprecated, but used for public reexport under `std::os::unix::raw`, as
18+
// well as `std::os::macos`/`std::os::ios`, because those modules precede the
19+
// decision to remove these.
20+
pub(super)mod raw;

‎std/src/os/ios/raw.rs‎renamed to ‎std/src/os/darwin/raw.rs‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
//! iOS-specific raw type definitions
2-
3-
#![stable(feature ="raw_ext", since ="1.1.0")]
4-
#![deprecated(
5-
since ="1.8.0",
6-
note ="these type aliases are no longer supported by\
7-
the standard library, the `libc` crate on\
8-
crates.io should be used instead for the correct\
9-
definitions"
10-
)]
11-
#![allow(deprecated)]
12-
1+
//! Apple-specific raw type definitions
132
usecrate::os::raw::c_long;
143

154
#[stable(feature ="raw_ext", since ="1.1.0")]
@@ -35,6 +24,7 @@ pub type pthread_t = usize;
3524
#[repr(C)]
3625
#[derive(Clone)]
3726
#[stable(feature ="raw_ext", since ="1.1.0")]
27+
#[allow(dead_code)]
3828
pubstructstat{
3929
#[stable(feature ="raw_ext", since ="1.1.0")]
4030
pubst_dev:i32,

‎std/src/os/ios/fs.rs‎

Lines changed: 0 additions & 160 deletions
This file was deleted.

‎std/src/os/ios/mod.rs‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,29 @@
22
33
#![stable(feature ="raw_ext", since ="1.1.0")]
44

5-
pubmod fs;
6-
pubmod raw;
5+
#[stable(feature ="metadata_ext", since ="1.1.0")]
6+
pubmod fs{
7+
#[doc(inline)]
8+
#[stable(feature ="file_set_times", since ="1.75.0")]
9+
pubusecrate::os::darwin::fs::FileTimesExt;
10+
11+
#[doc(inline)]
12+
#[stable(feature ="metadata_ext", since ="1.1.0")]
13+
pubusecrate::os::darwin::fs::MetadataExt;
14+
}
15+
16+
/// iOS-specific raw type definitions
17+
#[stable(feature ="raw_ext", since ="1.1.0")]
18+
#[deprecated(
19+
since ="1.8.0",
20+
note ="these type aliases are no longer supported by\
21+
the standard library, the `libc` crate on\
22+
crates.io should be used instead for the correct\
23+
definitions"
24+
)]
25+
#[allow(deprecated)]
26+
pubmod raw{
27+
#[doc(inline)]
28+
#[stable(feature ="raw_ext", since ="1.1.0")]
29+
pubusecrate::os::darwin::raw::*;
30+
}

‎std/src/os/macos/mod.rs‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,29 @@
22
33
#![stable(feature ="raw_ext", since ="1.1.0")]
44

5-
pubmod fs;
6-
pubmod raw;
5+
#[stable(feature ="metadata_ext", since ="1.1.0")]
6+
pubmod fs{
7+
#[doc(inline)]
8+
#[stable(feature ="file_set_times", since ="1.75.0")]
9+
pubusecrate::os::darwin::fs::FileTimesExt;
10+
11+
#[doc(inline)]
12+
#[stable(feature ="metadata_ext", since ="1.1.0")]
13+
pubusecrate::os::darwin::fs::MetadataExt;
14+
}
15+
16+
/// macOS-specific raw type definitions
17+
#[stable(feature ="raw_ext", since ="1.1.0")]
18+
#[deprecated(
19+
since ="1.8.0",
20+
note ="these type aliases are no longer supported by\
21+
the standard library, the `libc` crate on\
22+
crates.io should be used instead for the correct\
23+
definitions"
24+
)]
25+
#[allow(deprecated)]
26+
pubmod raw{
27+
#[doc(inline)]
28+
#[stable(feature ="raw_ext", since ="1.1.0")]
29+
pubusecrate::os::darwin::raw::*;
30+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp