From e34d5e51d3d9cc26a0316e7a29e75634e7954874 Mon Sep 17 00:00:00 2001 From: Tony Date: Mon, 14 Sep 2026 14:40:04 +0800 Subject: [PATCH 1/4] Bump gir to latest and regenerate files --- gir | 2 +- src/auto/class.rs | 1 + src/auto/context.rs | 24 ++++++++++++------------ src/auto/enums.rs | 1 + src/auto/exception.rs | 9 ++------- src/auto/flags.rs | 1 + src/auto/value.rs | 9 ++------- src/auto/versions.txt | 2 +- src/auto/virtual_machine.rs | 1 + src/auto/weak_value.rs | 20 +++++++++----------- sys/Cargo.toml | 32 +++++++++++++------------------- sys/build.rs | 16 +++++++--------- sys/src/lib.rs | 35 ++++++++++++++++++++++++----------- sys/tests/abi.rs | 2 +- sys/tests/constant.c | 6 +++--- sys/tests/layout.c | 2 +- 16 files changed, 80 insertions(+), 83 deletions(-) diff --git a/gir b/gir index 73df751..ee0e851 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit 73df75128d555e3d83cebc3c28bde56dd27a7ccd +Subproject commit ee0e85140a6fd40161f42fcd8bc0b21de9f00916 diff --git a/src/auto/class.rs b/src/auto/class.rs index eac723c..0ef453f 100644 --- a/src/auto/class.rs +++ b/src/auto/class.rs @@ -2,6 +2,7 @@ // from gir-files (https://github.com/tauri-apps/gir-files) // DO NOT EDIT +use crate::ffi; use glib::translate::*; glib::wrapper! { diff --git a/src/auto/context.rs b/src/auto/context.rs index 7a5278c..d1bd49b 100644 --- a/src/auto/context.rs +++ b/src/auto/context.rs @@ -2,7 +2,7 @@ // from gir-files (https://github.com/tauri-apps/gir-files) // DO NOT EDIT -use crate::{CheckSyntaxMode, CheckSyntaxResult, Exception, Value, VirtualMachine}; +use crate::{ffi, CheckSyntaxMode, CheckSyntaxResult, Exception, Value, VirtualMachine}; use glib::{prelude::*, translate::*}; use std::boxed::Box as Box_; @@ -86,12 +86,7 @@ impl ContextBuilder { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait ContextExt: IsA + sealed::Sealed + 'static { +pub trait ContextExt: IsA + 'static { #[doc(alias = "jsc_context_check_syntax")] fn check_syntax( &self, @@ -187,6 +182,7 @@ pub trait ContextExt: IsA + sealed::Sealed + 'static { #[doc(alias = "jsc_context_get_virtual_machine")] #[doc(alias = "get_virtual_machine")] + #[doc(alias = "virtual-machine")] fn virtual_machine(&self) -> Option { unsafe { from_glib_none(ffi::jsc_context_get_virtual_machine( @@ -210,16 +206,20 @@ pub trait ContextExt: IsA + sealed::Sealed + 'static { exception: *mut ffi::JSCException, user_data: glib::ffi::gpointer, ) { - let context = from_glib_borrow(context); - let exception = from_glib_borrow(exception); - let callback: &P = &*(user_data as *mut _); - (*callback)(&context, &exception) + unsafe { + let context = from_glib_borrow(context); + let exception = from_glib_borrow(exception); + let callback = &*(user_data as *mut P); + (*callback)(&context, &exception) + } } let handler = Some(handler_func::

as _); unsafe extern "C" fn destroy_notify_func( data: glib::ffi::gpointer, ) { - let _callback: Box_

= Box_::from_raw(data as *mut _); + unsafe { + let _callback = Box_::from_raw(data as *mut P); + } } let destroy_call3 = Some(destroy_notify_func::

as _); let super_callback0: Box_

= handler_data; diff --git a/src/auto/enums.rs b/src/auto/enums.rs index 4f3a93b..90a5a82 100644 --- a/src/auto/enums.rs +++ b/src/auto/enums.rs @@ -2,6 +2,7 @@ // from gir-files (https://github.com/tauri-apps/gir-files) // DO NOT EDIT +use crate::ffi; use glib::translate::*; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] diff --git a/src/auto/exception.rs b/src/auto/exception.rs index a972cc0..d6df416 100644 --- a/src/auto/exception.rs +++ b/src/auto/exception.rs @@ -2,7 +2,7 @@ // from gir-files (https://github.com/tauri-apps/gir-files) // DO NOT EDIT -use crate::Context; +use crate::{ffi, Context}; use glib::{prelude::*, translate::*}; glib::wrapper! { @@ -69,12 +69,7 @@ impl std::fmt::Display for Exception { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait ExceptionExt: IsA + sealed::Sealed + 'static { +pub trait ExceptionExt: IsA + 'static { #[doc(alias = "jsc_exception_get_backtrace_string")] #[doc(alias = "get_backtrace_string")] fn backtrace_string(&self) -> Option { diff --git a/src/auto/flags.rs b/src/auto/flags.rs index a85f6ca..8f00faa 100644 --- a/src/auto/flags.rs +++ b/src/auto/flags.rs @@ -2,6 +2,7 @@ // from gir-files (https://github.com/tauri-apps/gir-files) // DO NOT EDIT +use crate::ffi; use glib::{bitflags::bitflags, translate::*}; bitflags! { diff --git a/src/auto/value.rs b/src/auto/value.rs index cd5c976..601a3d2 100644 --- a/src/auto/value.rs +++ b/src/auto/value.rs @@ -5,7 +5,7 @@ #[cfg(feature = "v2_38")] #[cfg_attr(docsrs, doc(cfg(feature = "v2_38")))] use crate::TypedArrayType; -use crate::{Context, ValuePropertyFlags}; +use crate::{ffi, Context, ValuePropertyFlags}; use glib::{prelude::*, translate::*}; glib::wrapper! { @@ -190,12 +190,7 @@ impl ValueBuilder { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait ValueExt: IsA + sealed::Sealed + 'static { +pub trait ValueExt: IsA + 'static { #[cfg(feature = "v2_38")] #[cfg_attr(docsrs, doc(cfg(feature = "v2_38")))] #[doc(alias = "jsc_value_array_buffer_get_size")] diff --git a/src/auto/versions.txt b/src/auto/versions.txt index 6c24c88..27d3af4 100644 --- a/src/auto/versions.txt +++ b/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 73df75128d55) +Generated by gir (https://github.com/gtk-rs/gir @ ee0e85140a6f) from gir-files (https://github.com/tauri-apps/gir-files @ 8be196040235) diff --git a/src/auto/virtual_machine.rs b/src/auto/virtual_machine.rs index ed2a303..15efed1 100644 --- a/src/auto/virtual_machine.rs +++ b/src/auto/virtual_machine.rs @@ -2,6 +2,7 @@ // from gir-files (https://github.com/tauri-apps/gir-files) // DO NOT EDIT +use crate::ffi; use glib::translate::*; glib::wrapper! { diff --git a/src/auto/weak_value.rs b/src/auto/weak_value.rs index 52d7fc1..3c1d6e4 100644 --- a/src/auto/weak_value.rs +++ b/src/auto/weak_value.rs @@ -2,8 +2,9 @@ // from gir-files (https://github.com/tauri-apps/gir-files) // DO NOT EDIT -use crate::Value; +use crate::{ffi, Value}; use glib::{ + object::ObjectType as _, prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, @@ -72,12 +73,7 @@ impl WeakValueBuilder { } } -mod sealed { - pub trait Sealed {} - impl> Sealed for T {} -} - -pub trait WeakValueExt: IsA + sealed::Sealed + 'static { +pub trait WeakValueExt: IsA + 'static { #[doc(alias = "jsc_weak_value_get_value")] #[doc(alias = "get_value")] fn value(&self) -> Option { @@ -94,15 +90,17 @@ pub trait WeakValueExt: IsA + sealed::Sealed + 'static { this: *mut ffi::JSCWeakValue, f: glib::ffi::gpointer, ) { - let f: &F = &*(f as *const F); - f(WeakValue::from_glib_borrow(this).unsafe_cast_ref()) + unsafe { + let f: &F = &*(f as *const F); + f(WeakValue::from_glib_borrow(this).unsafe_cast_ref()) + } } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, - b"cleared\0".as_ptr() as *const _, - Some(std::mem::transmute::<_, unsafe extern "C" fn()>( + c"cleared".as_ptr(), + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( cleared_trampoline:: as *const (), )), Box_::into_raw(f), diff --git a/sys/Cargo.toml b/sys/Cargo.toml index 4180f78..364decc 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -1,9 +1,9 @@ [package] -authors = [ "The Gtk-rs Project Developers" ] +authors = ["The Gtk-rs Project Developers"] build = "build.rs" description = "Sys functions for the Rust bindings of the javacriptcore library" edition = "2021" -keywords = [ "javascript", "gtk-rs", "gnome" ] +keywords = ["javascript", "gtk-rs", "gnome"] license = "MIT" name = "javascriptcore-rs-sys" repository = "https://github.com/tauri-apps/javascriptcore-rs" @@ -13,15 +13,15 @@ version = "1.1.1" name = "javascriptcoregtk-4.1" version = "2.24" - [package.metadata.system-deps.javascriptcoregtk_4_1.v2_28] - version = "2.28" +[package.metadata.system-deps.javascriptcoregtk_4_1.v2_28] +version = "2.28" - [package.metadata.system-deps.javascriptcoregtk_4_1.v2_38] - version = "2.38" +[package.metadata.system-deps.javascriptcoregtk_4_1.v2_38] +version = "2.38" [package.metadata.docs.rs] -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition" ] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] all-features = true [lib] @@ -29,22 +29,16 @@ name = "javascriptcore_rs_sys" [dependencies] libc = "0.2" - - [dependencies.glib] - package = "glib-sys" - version = "^0.22" - - [dependencies.gobject] - package = "gobject-sys" - version = "^0.22" +glib-sys = "^0.22" +gobject-sys = "^0.22" [build-dependencies] -system-deps = "6" +system-deps = "9" [dev-dependencies] shell-words = "1.0.0" tempfile = "3" [features] -v2_28 = [ ] -v2_38 = [ "v2_28" ] +v2_28 = [] +v2_38 = ["v2_28"] diff --git a/sys/build.rs b/sys/build.rs index 7b45915..80b58cf 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -1,17 +1,15 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 73df75128d55) +// Generated by gir (https://github.com/gtk-rs/gir @ ee0e85140a6f) // from ../gir-files (@ 8be196040235) // DO NOT EDIT -#[cfg(not(docsrs))] -use std::process; - -#[cfg(docsrs)] -fn main() {} // prevent linking libraries to avoid documentation failure - -#[cfg(not(docsrs))] fn main() { + if std::env::var("DOCS_RS").is_ok() { + // prevent linking libraries to avoid documentation failure + return; + } + if let Err(s) = system_deps::Config::new().probe() { println!("cargo:warning={s}"); - process::exit(1); + std::process::exit(1); } } diff --git a/sys/src/lib.rs b/sys/src/lib.rs index b889e38..f4f1a84 100644 --- a/sys/src/lib.rs +++ b/sys/src/lib.rs @@ -1,4 +1,4 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 73df75128d55) +// Generated by gir (https://github.com/gtk-rs/gir @ ee0e85140a6f) // from ../gir-files (@ 8be196040235) // DO NOT EDIT @@ -11,10 +11,17 @@ )] #![cfg_attr(docsrs, feature(doc_cfg))] +use glib_sys as glib; +use gobject_sys as gobject; + +#[cfg(unix)] +#[allow(unused_imports)] +use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t}; +#[allow(unused_imports)] +use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE}; #[allow(unused_imports)] -use libc::{ +use std::ffi::{ c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, - intptr_t, size_t, ssize_t, uintptr_t, FILE, }; #[allow(unused_imports)] @@ -97,12 +104,13 @@ pub type JSCOptionsFunc = // Records #[repr(C)] +#[allow(dead_code)] pub struct _JSCClassClass { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, } -pub type JSCClassClass = *mut _JSCClassClass; +pub type JSCClassClass = _JSCClassClass; #[derive(Copy, Clone)] #[repr(C)] @@ -157,12 +165,13 @@ impl ::std::fmt::Debug for JSCContextClass { } #[repr(C)] +#[allow(dead_code)] pub struct _JSCContextPrivate { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, } -pub type JSCContextPrivate = *mut _JSCContextPrivate; +pub type JSCContextPrivate = _JSCContextPrivate; #[derive(Copy, Clone)] #[repr(C)] @@ -187,12 +196,13 @@ impl ::std::fmt::Debug for JSCExceptionClass { } #[repr(C)] +#[allow(dead_code)] pub struct _JSCExceptionPrivate { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, } -pub type JSCExceptionPrivate = *mut _JSCExceptionPrivate; +pub type JSCExceptionPrivate = _JSCExceptionPrivate; #[derive(Copy, Clone)] #[repr(C)] @@ -217,12 +227,13 @@ impl ::std::fmt::Debug for JSCValueClass { } #[repr(C)] +#[allow(dead_code)] pub struct _JSCValuePrivate { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, } -pub type JSCValuePrivate = *mut _JSCValuePrivate; +pub type JSCValuePrivate = _JSCValuePrivate; #[derive(Copy, Clone)] #[repr(C)] @@ -247,12 +258,13 @@ impl ::std::fmt::Debug for JSCVirtualMachineClass { } #[repr(C)] +#[allow(dead_code)] pub struct _JSCVirtualMachinePrivate { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, } -pub type JSCVirtualMachinePrivate = *mut _JSCVirtualMachinePrivate; +pub type JSCVirtualMachinePrivate = _JSCVirtualMachinePrivate; #[derive(Copy, Clone)] #[repr(C)] @@ -277,15 +289,17 @@ impl ::std::fmt::Debug for JSCWeakValueClass { } #[repr(C)] +#[allow(dead_code)] pub struct _JSCWeakValuePrivate { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, } -pub type JSCWeakValuePrivate = *mut _JSCWeakValuePrivate; +pub type JSCWeakValuePrivate = _JSCWeakValuePrivate; // Classes #[repr(C)] +#[allow(dead_code)] pub struct JSCClass { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, @@ -372,8 +386,7 @@ impl ::std::fmt::Debug for JSCWeakValue { } } -#[link(name = "javascriptcoregtk-4.1")] -extern "C" { +unsafe extern "C" { //========================================================================= // JSCClass diff --git a/sys/tests/abi.rs b/sys/tests/abi.rs index 77a47f6..9df3bc8 100644 --- a/sys/tests/abi.rs +++ b/sys/tests/abi.rs @@ -1,4 +1,4 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 73df75128d55) +// Generated by gir (https://github.com/gtk-rs/gir @ ee0e85140a6f) // from ../gir-files (@ 8be196040235) // DO NOT EDIT diff --git a/sys/tests/constant.c b/sys/tests/constant.c index 48d7418..888b5a7 100644 --- a/sys/tests/constant.c +++ b/sys/tests/constant.c @@ -1,4 +1,4 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 73df75128d55) +// Generated by gir (https://github.com/gtk-rs/gir @ ee0e85140a6f) // from ../gir-files (@ 8be196040235) // DO NOT EDIT @@ -21,8 +21,8 @@ unsigned long: "%lu", \ long long: "%lld", \ unsigned long long: "%llu", \ - float: "%f", \ - double: "%f", \ + float: "%.6f", \ + double: "%.6f", \ long double: "%ld"), \ CONSTANT_NAME); \ printf("\n"); diff --git a/sys/tests/layout.c b/sys/tests/layout.c index e4d96bd..1c1c6bb 100644 --- a/sys/tests/layout.c +++ b/sys/tests/layout.c @@ -1,4 +1,4 @@ -// Generated by gir (https://github.com/gtk-rs/gir @ 73df75128d55) +// Generated by gir (https://github.com/gtk-rs/gir @ ee0e85140a6f) // from ../gir-files (@ 8be196040235) // DO NOT EDIT From be089e415fd4e4226dec93a206585c2285cbdb4d Mon Sep 17 00:00:00 2001 From: Tony Date: Mon, 14 Sep 2026 14:45:07 +0800 Subject: [PATCH 2/4] use ffi --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 9e25811..e82265e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,8 @@ // // Licensed under the MIT license, see the LICENSE file or #![cfg_attr(docsrs, feature(doc_cfg))] +use ffi; + mod auto; pub use auto::{traits::*, *}; From 81476c05de56974eb011b548b680c95458d34306 Mon Sep 17 00:00:00 2001 From: Tony Date: Mon, 14 Sep 2026 14:49:44 +0800 Subject: [PATCH 3/4] remove `--cfg docsrs` --- Cargo.toml | 2 -- sys/Cargo.toml | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1d6ea06..4b368b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,6 @@ version = "1.1.2" [package.metadata.docs.rs] all-features = true -rustc-args = [ "--cfg", "docsrs" ] -rustdoc-args = [ "--cfg", "docsrs" ] [lib] name = "javascriptcore" diff --git a/sys/Cargo.toml b/sys/Cargo.toml index 364decc..f8fc588 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -20,8 +20,7 @@ version = "2.28" version = "2.38" [package.metadata.docs.rs] -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] all-features = true [lib] From c8c8cc705969eb52cb20ae4b7c4c1202a18d5b9e Mon Sep 17 00:00:00 2001 From: Tony Date: Mon, 14 Sep 2026 14:53:46 +0800 Subject: [PATCH 4/4] change file --- .changes/bump-gir.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/bump-gir.md diff --git a/.changes/bump-gir.md b/.changes/bump-gir.md new file mode 100644 index 0000000..840e0d9 --- /dev/null +++ b/.changes/bump-gir.md @@ -0,0 +1,6 @@ +--- +"javascriptcore-rs": major +"javascriptcore-rs-sys": major +--- + +Bumped `gir` to `ee0e85140a6f` and regenerated bindings.