From 21cf6109564fd39c522890cc409f68997d761a11 Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Wed, 8 Jan 2025 12:05:29 -0500 Subject: [PATCH] Update bindgen --- Cargo.lock | 16 ++++------------ crates/rb-sys-build/Cargo.toml | 4 ++-- crates/rb-sys-build/src/bindings/stable_api.rs | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 834ca38e..78c7e716 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,16 +13,14 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" dependencies = [ "bitflags", "cexpr", "clang-sys", "itertools", - "lazy_static", - "lazycell", "proc-macro2", "quote", "regex", @@ -112,12 +110,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" version = "0.2.155" @@ -271,9 +263,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustix" diff --git a/crates/rb-sys-build/Cargo.toml b/crates/rb-sys-build/Cargo.toml index c25e3104..a92ee726 100644 --- a/crates/rb-sys-build/Cargo.toml +++ b/crates/rb-sys-build/Cargo.toml @@ -15,11 +15,11 @@ doctest = false [dependencies] regex = "1" shell-words = "1.1" -bindgen = { version = "0.69", default-features = false, features = ["runtime"] } +bindgen = { version = "0.71", default-features = false, features = ["runtime"] } syn = { version = "2.0", features = ["parsing", "full", "extra-traits"] } quote = "1.0" lazy_static = "1.4.0" -proc-macro2 = "1.0" +proc-macro2 = "1.0.92" [features] default = [] diff --git a/crates/rb-sys-build/src/bindings/stable_api.rs b/crates/rb-sys-build/src/bindings/stable_api.rs index 479da284..786245dd 100644 --- a/crates/rb-sys-build/src/bindings/stable_api.rs +++ b/crates/rb-sys-build/src/bindings/stable_api.rs @@ -75,6 +75,21 @@ pub fn categorize_bindings(syntax: &mut syn::File) { } }; } + } else if let syn::Item::Const(ref mut c) = item { + if c.ident == syn::Ident::new("_", c.ident.span()) { + let body = &mut c.expr; + let code = body.clone().to_token_stream().to_string(); + let new_code = code.replace("rb_sys__Opaque__", ""); + let new_code = syn::parse_str::(&new_code).unwrap(); + + *body = syn::parse_quote! { + { + #[allow(unused_imports)] + use crate::internal::*; + #new_code + } + }; + } } normal_items.push(item.clone());