Skip to content

Commit e1d641f

Browse files
committed
Don't expose stat and as_raw_stat on platforms where we don't need to
1 parent 200e11e commit e1d641f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::sys_common::{AsInner, AsInnerMut, IntoInner};
66
use crate::time::SystemTime;
77

88
#[allow(deprecated)]
9+
#[cfg(any(target_os = "macos", target_os = "ios"))]
910
use super::raw;
1011

1112
/// OS-specific extensions to [`fs::Metadata`].
@@ -26,6 +27,8 @@ pub trait MetadataExt {
2627
methods of this trait"
2728
)]
2829
#[allow(deprecated)]
30+
// To maintain backwards compat, is omitted on other Apple targets.
31+
#[cfg(any(target_os = "macos", target_os = "ios"))]
2932
fn as_raw_stat(&self) -> &raw::stat;
3033

3134
#[stable(feature = "metadata_ext2", since = "1.8.0")]
@@ -78,6 +81,8 @@ pub trait MetadataExt {
7881
#[stable(feature = "metadata_ext", since = "1.1.0")]
7982
impl MetadataExt for Metadata {
8083
#[allow(deprecated)]
84+
// To maintain backwards compat, is omitted on other Apple targets.
85+
#[cfg(any(target_os = "macos", target_os = "ios"))]
8186
fn as_raw_stat(&self) -> &raw::stat {
8287
unsafe { &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) }
8388
}

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

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
)]
1414
#![allow(deprecated)]
1515

16+
#[cfg(any(target_os = "macos", target_os = "ios"))]
1617
use crate::os::raw::c_long;
1718

1819
#[stable(feature = "raw_ext", since = "1.1.0")]
@@ -38,6 +39,8 @@ pub type pthread_t = usize;
3839
#[repr(C)]
3940
#[derive(Clone)]
4041
#[stable(feature = "raw_ext", since = "1.1.0")]
42+
// To maintain backwards compat, is omitted on other Apple targets.
43+
#[cfg(any(target_os = "macos", target_os = "ios"))]
4144
pub struct stat {
4245
#[stable(feature = "raw_ext", since = "1.1.0")]
4346
pub st_dev: i32,

0 commit comments

Comments
 (0)