From 752ae6adde5bde9743ab314ff0a4c3e690a5e2d2 Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Fri, 17 May 2024 11:55:10 -0400 Subject: [PATCH] Address review comments and minor renaming --- Cargo.toml | 2 +- ctru-sys/Cargo.toml | 3 ++- ctru-sys/build/test_gen.rs | 3 +-- ctru-sys/tests/layout_test.rs | 9 +++++++-- test-runner/Cargo.toml | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 29d38753..caaf7866 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["ctru-rs", "ctru-sys"] resolver = "2" [workspace.dependencies] -libc = { version = "0.2.121", default-features = false } +libc = { version = "0.2.153", default-features = false } shim-3ds = { git = "https://github.com/rust3ds/shim-3ds.git" } pthread-3ds = { git = "https://github.com/rust3ds/pthread-3ds.git" } test-runner = { git = "https://github.com/rust3ds/ctru-rs.git" } diff --git a/ctru-sys/Cargo.toml b/ctru-sys/Cargo.toml index c20f270b..9253367e 100644 --- a/ctru-sys/Cargo.toml +++ b/ctru-sys/Cargo.toml @@ -35,6 +35,7 @@ libc = { workspace = true } [build-dependencies] bindgen = { version = "0.69", features = ["experimental"] } cc = "1.0" +# Use git dependency so we can use https://github.com/mystor/rust-cpp/pull/111 cpp_build = { optional = true, git = "https://github.com/mystor/rust-cpp.git" } doxygen-rs = "0.4.2" itertools = "0.11.0" @@ -47,7 +48,7 @@ which = "4.4.0" [dev-dependencies] shim-3ds = { workspace = true } test-runner = { workspace = true } -cpp = { git = "https://github.com/mystor/rust-cpp.git" } +cpp = "0.5.9" [package.metadata.docs.rs] default-target = "armv6k-nintendo-3ds" diff --git a/ctru-sys/build/test_gen.rs b/ctru-sys/build/test_gen.rs index db0c97c5..2609e778 100644 --- a/ctru-sys/build/test_gen.rs +++ b/ctru-sys/build/test_gen.rs @@ -143,7 +143,6 @@ impl LayoutTestGenerator { fn build_struct_test(&self, struct_name: &str) -> proc_macro2::TokenStream { let name = format_ident!("{struct_name}"); - let test_name = format_ident!("layout_test_{name}"); let mut field_tests = Vec::new(); field_tests.push(build_assert_eq( @@ -194,7 +193,7 @@ impl LayoutTestGenerator { quote! { #[test] - fn #test_name() { + fn #name() { #(#field_tests);* } } diff --git a/ctru-sys/tests/layout_test.rs b/ctru-sys/tests/layout_test.rs index 88350fc0..55f8995a 100644 --- a/ctru-sys/tests/layout_test.rs +++ b/ctru-sys/tests/layout_test.rs @@ -6,7 +6,6 @@ //! ABI used by libctru and the devkitARM toolchain, instead of just what libclang //! thinks they should be at bindgen time. -#![allow(non_snake_case)] #![feature(custom_test_frameworks)] #![test_runner(test_runner::run_gdb)] @@ -52,7 +51,13 @@ macro_rules! align_of { }; } -include!(concat!(env!("OUT_DIR"), "/generated_layout_test.rs")); +#[allow(non_snake_case)] +#[allow(non_upper_case_globals)] +mod generated { + use super::*; + + include!(concat!(env!("OUT_DIR"), "/generated_layout_test.rs")); +} mod helper_test { macro_rules! packed_struct { diff --git a/test-runner/Cargo.toml b/test-runner/Cargo.toml index 6d496994..c5d02d24 100644 --- a/test-runner/Cargo.toml +++ b/test-runner/Cargo.toml @@ -11,4 +11,4 @@ socket = [] [dependencies] ctru-rs = { git = "https://github.com/rust3ds/ctru-rs" } ctru-sys = { git = "https://github.com/rust3ds/ctru-rs" } -libc = "0.2.147" +libc = { workspace = true }