diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0487a66c..1f39fdab 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,7 +22,7 @@ jobs: - uses: rust3ds/test-runner/setup@v1 with: - toolchain: nightly + toolchain: nightly-2024-02-18 - name: Build workspace docs run: cargo 3ds --verbose doc --verbose --no-deps --workspace diff --git a/ctru-sys/build.rs b/ctru-sys/build.rs index 278bd00a..71ad909c 100644 --- a/ctru-sys/build.rs +++ b/ctru-sys/build.rs @@ -76,9 +76,18 @@ fn main() { .layout_tests(true) .ctypes_prefix("::libc") .prepend_enum_name(false) + .allowlist_file(include_path.join("3ds[.]h").to_string_lossy()) + .allowlist_file(include_path.join("3ds/.*").to_string_lossy()) + .allowlist_function("__errno") + .blocklist_function("gethost(id|name)") .blocklist_type("u(8|16|32|64)") .blocklist_type("__builtin_va_list") .blocklist_type("__va_list") + .blocklist_type("timeval") + .blocklist_type("in_addr") + .blocklist_type("sockaddr_storage") + .blocklist_type("(in_addr|wchar|socklen|suseconds|sa_family|time)_t") + .blocklist_item("SOL_CONFIG") .opaque_type("MiiData") .derive_default(true) .wrap_static_fns(true) diff --git a/ctru-sys/src/lib.rs b/ctru-sys/src/lib.rs index b9f71de9..ed2127b7 100644 --- a/ctru-sys/src/lib.rs +++ b/ctru-sys/src/lib.rs @@ -3,6 +3,7 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(clippy::all)] +#![deny(ambiguous_glob_reexports)] #![cfg_attr(test, feature(custom_test_frameworks))] #![cfg_attr(test, test_runner(test_runner::run_gdb))] #![doc( @@ -16,7 +17,19 @@ pub mod result; pub use result::*; -include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +// By only exporting the `libc` module in tests, we can catch any potential conflicts between +// generated bindings and existing `libc` types, since we use #[deny(ambiguous_glob_reexports)]. +#[cfg(test)] +pub use libc::*; + +mod bindings { + // Meanwhile, make sure generated bindings can still refer to libc types if needed: + use libc::*; + + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +} + +pub use bindings::*; /// In lieu of a proper errno function exposed by libc /// ().