Skip to content

Commit e2301ca

Browse files
committed
Auto merge of #95375 - MarcusCalhoun-Lopez:i686_apple_darwin, r=m-ou-se
Fix build on i686-apple-darwin systems Replace `target_arch = "x86_64"` with `not(target_arch = "aarch64")` so that i686-apple-darwin systems dynamically choose implementation.
2 parents abf0ec8 + 8c18844 commit e2301ca

File tree

1 file changed

+8
-5
lines changed
  • library/std/src/sys/unix

1 file changed

+8
-5
lines changed

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -1535,12 +1535,12 @@ mod remove_dir_impl {
15351535
use crate::sync::Arc;
15361536
use crate::sys::{cvt, cvt_r};
15371537

1538-
#[cfg(not(all(target_os = "macos", target_arch = "x86_64"),))]
1538+
#[cfg(not(all(target_os = "macos", not(target_arch = "aarch64")),))]
15391539
use libc::{fdopendir, openat, unlinkat};
1540-
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
1540+
#[cfg(all(target_os = "macos", not(target_arch = "aarch64")))]
15411541
use macos_weak::{fdopendir, openat, unlinkat};
15421542

1543-
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
1543+
#[cfg(all(target_os = "macos", not(target_arch = "aarch64")))]
15441544
mod macos_weak {
15451545
use crate::sys::weak::weak;
15461546
use libc::{c_char, c_int, DIR};
@@ -1562,6 +1562,9 @@ mod remove_dir_impl {
15621562
}
15631563

15641564
pub unsafe fn fdopendir(fd: c_int) -> *mut DIR {
1565+
#[cfg(all(target_os = "macos", target_arch = "x86"))]
1566+
weak!(fn fdopendir(c_int) -> *mut DIR, "fdopendir$INODE64$UNIX2003");
1567+
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
15651568
weak!(fn fdopendir(c_int) -> *mut DIR, "fdopendir$INODE64");
15661569
fdopendir.get().map(|fdopendir| fdopendir(fd)).unwrap_or_else(|| {
15671570
crate::sys::unix::os::set_errno(libc::ENOSYS);
@@ -1699,12 +1702,12 @@ mod remove_dir_impl {
16991702
}
17001703
}
17011704

1702-
#[cfg(not(all(target_os = "macos", target_arch = "x86_64")))]
1705+
#[cfg(not(all(target_os = "macos", not(target_arch = "aarch64"))))]
17031706
pub fn remove_dir_all(p: &Path) -> io::Result<()> {
17041707
remove_dir_all_modern(p)
17051708
}
17061709

1707-
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
1710+
#[cfg(all(target_os = "macos", not(target_arch = "aarch64")))]
17081711
pub fn remove_dir_all(p: &Path) -> io::Result<()> {
17091712
if macos_weak::has_openat() {
17101713
// openat() is available with macOS 10.10+, just like unlinkat() and fdopendir()

0 commit comments

Comments
 (0)