1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-19 15:35:37 +02:00

Run builds on both Mac OS and Linux (#830)

* Run builds on both Mac OS and Linux

This would have helped us catch #570.

* Fix MacOS CI (#848)

* Revert unnecessary changes

The changes might be good, but I want to keep this PR small and
focused. If we end up with the extra `cfg` statements, we should
include a comment to let students know what they do: we’re targeting
people new to Rust, so we need to be careful with explanations.

---------

Co-authored-by: Dominik Maier <domenukk@gmail.com>
This commit is contained in:
Martin Geisler
2023-06-22 10:38:41 +02:00
committed by GitHub
parent 4ed75d6b65
commit 186d333227
2 changed files with 18 additions and 2 deletions

View File

@ -37,7 +37,7 @@ mod ffi {
}
// Layout as per man entry for dirent
#[cfg(target_os = "macos")]
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
#[repr(C)]
pub struct dirent {
pub d_ino: u64,
@ -48,6 +48,17 @@ mod ffi {
pub d_name: [c_char; 1024],
}
// Layout according to <https://github.com/rust-lang/libc/issues/414>
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
#[repr(C)]
pub struct dirent {
pub d_fileno: u32,
pub d_reclen: u16,
pub d_type: u8,
pub d_namlen: u8,
pub d_name: [c_char; 256],
}
extern "C" {
pub fn opendir(s: *const c_char) -> *mut DIR;
pub fn readdir(s: *mut DIR) -> *const dirent;