From e6d132b714dc4cf1ed89a6330d954148bde86420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 2 Dec 2025 11:08:42 +0200 Subject: [PATCH 01/14] Update gir --- gir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gir b/gir index 697875997360..3ddfba1db34e 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit 69787599736087d21d2e60e03c2e1292af9f6343 +Subproject commit 3ddfba1db34e9358a71a4007a09bcf7fb20fd347 From 5a68e63684e2e8a1f7f33f84942f7883e55bb2d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 2 Dec 2025 11:10:13 +0200 Subject: [PATCH 02/14] Regenerate with latest gir --- gdk-pixbuf/src/auto/versions.txt | 2 +- gdk-pixbuf/sys/build.rs | 14 ++++++-------- gdk-pixbuf/sys/versions.txt | 2 +- gio/src/auto/versions.txt | 2 +- gio/sys/build.rs | 14 ++++++-------- gio/sys/versions.txt | 2 +- glib/gobject-sys/build.rs | 14 ++++++-------- glib/gobject-sys/versions.txt | 2 +- glib/src/auto/versions.txt | 2 +- glib/sys/build.rs | 14 ++++++-------- glib/sys/versions.txt | 2 +- graphene/src/auto/versions.txt | 2 +- graphene/sys/build.rs | 14 ++++++-------- graphene/sys/versions.txt | 2 +- pango/src/auto/versions.txt | 2 +- pango/sys/build.rs | 14 ++++++-------- pango/sys/versions.txt | 2 +- pangocairo/src/auto/versions.txt | 2 +- pangocairo/sys/build.rs | 14 ++++++-------- pangocairo/sys/versions.txt | 2 +- 20 files changed, 55 insertions(+), 69 deletions(-) diff --git a/gdk-pixbuf/src/auto/versions.txt b/gdk-pixbuf/src/auto/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/gdk-pixbuf/src/auto/versions.txt +++ b/gdk-pixbuf/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/gdk-pixbuf/sys/build.rs b/gdk-pixbuf/sys/build.rs index e98844f2d792..7341ed1620c9 100644 --- a/gdk-pixbuf/sys/build.rs +++ b/gdk-pixbuf/sys/build.rs @@ -2,16 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // 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/gdk-pixbuf/sys/versions.txt b/gdk-pixbuf/sys/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/gdk-pixbuf/sys/versions.txt +++ b/gdk-pixbuf/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/gio/src/auto/versions.txt b/gio/src/auto/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/gio/src/auto/versions.txt +++ b/gio/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/gio/sys/build.rs b/gio/sys/build.rs index e98844f2d792..7341ed1620c9 100644 --- a/gio/sys/build.rs +++ b/gio/sys/build.rs @@ -2,16 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // 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/gio/sys/versions.txt b/gio/sys/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/gio/sys/versions.txt +++ b/gio/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/glib/gobject-sys/build.rs b/glib/gobject-sys/build.rs index e98844f2d792..7341ed1620c9 100644 --- a/glib/gobject-sys/build.rs +++ b/glib/gobject-sys/build.rs @@ -2,16 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // 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/glib/gobject-sys/versions.txt b/glib/gobject-sys/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/glib/gobject-sys/versions.txt +++ b/glib/gobject-sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/glib/src/auto/versions.txt b/glib/src/auto/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/glib/src/auto/versions.txt +++ b/glib/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/glib/sys/build.rs b/glib/sys/build.rs index e98844f2d792..7341ed1620c9 100644 --- a/glib/sys/build.rs +++ b/glib/sys/build.rs @@ -2,16 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // 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/glib/sys/versions.txt b/glib/sys/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/glib/sys/versions.txt +++ b/glib/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/graphene/src/auto/versions.txt b/graphene/src/auto/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/graphene/src/auto/versions.txt +++ b/graphene/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/graphene/sys/build.rs b/graphene/sys/build.rs index e98844f2d792..7341ed1620c9 100644 --- a/graphene/sys/build.rs +++ b/graphene/sys/build.rs @@ -2,16 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // 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/graphene/sys/versions.txt b/graphene/sys/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/graphene/sys/versions.txt +++ b/graphene/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/pango/src/auto/versions.txt b/pango/src/auto/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/pango/src/auto/versions.txt +++ b/pango/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/pango/sys/build.rs b/pango/sys/build.rs index e98844f2d792..7341ed1620c9 100644 --- a/pango/sys/build.rs +++ b/pango/sys/build.rs @@ -2,16 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // 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/pango/sys/versions.txt b/pango/sys/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/pango/sys/versions.txt +++ b/pango/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/pangocairo/src/auto/versions.txt b/pangocairo/src/auto/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/pangocairo/src/auto/versions.txt +++ b/pangocairo/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) diff --git a/pangocairo/sys/build.rs b/pangocairo/sys/build.rs index e98844f2d792..7341ed1620c9 100644 --- a/pangocairo/sys/build.rs +++ b/pangocairo/sys/build.rs @@ -2,16 +2,14 @@ // from gir-files (https://github.com/gtk-rs/gir-files) // 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/pangocairo/sys/versions.txt b/pangocairo/sys/versions.txt index ab0fef638839..ce23f6eb3fb2 100644 --- a/pangocairo/sys/versions.txt +++ b/pangocairo/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 697875997360) +Generated by gir (https://github.com/gtk-rs/gir @ 3ddfba1db34e) from gir-files (https://github.com/gtk-rs/gir-files @ 1490bcc19dc8) From 3959107c3b5ab790dc625b16a8847e734a512684 Mon Sep 17 00:00:00 2001 From: Biagio Festa Date: Fri, 14 Nov 2025 16:27:20 +0100 Subject: [PATCH 03/14] glib/bytes: relax start offset constraint for `from_bytes` --- glib/src/bytes.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glib/src/bytes.rs b/glib/src/bytes.rs index 3ae586fcc91d..655597f25cab 100644 --- a/glib/src/bytes.rs +++ b/glib/src/bytes.rs @@ -109,7 +109,7 @@ impl Bytes { Bound::Excluded(v) => v.checked_add(1).expect("Invalid start offset"), Bound::Unbounded => 0, }; - assert!(start_offset < len, "Start offset after valid range"); + assert!(start_offset <= len, "Start offset after valid range"); let end_offset = match range.end_bound() { Bound::Included(v) => v.checked_add(1).expect("Invalid end offset"), @@ -338,6 +338,8 @@ mod tests { assert_eq!(b2, [1u8, 2u8].as_ref()); let b2 = Bytes::from_bytes(&b1, ..); assert_eq!(b2, [1u8, 2u8, 3u8].as_ref()); + let b2 = Bytes::from_bytes(&b1, 3..); + assert_eq!(b2, [].as_ref()); } #[test] From 11d0df1d3cbf71b284355d9084cb0d74fb8455aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 18 Nov 2025 11:48:10 +0200 Subject: [PATCH 04/14] glib: Fix typo in docs --- glib/src/log.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/src/log.rs b/glib/src/log.rs index 6b30dd85ff4a..6f76ff5779ad 100644 --- a/glib/src/log.rs +++ b/glib/src/log.rs @@ -862,7 +862,7 @@ macro_rules! g_printerr { /// "MY_FIELD" => "123"; /// // fields can also take format arguments /// "MY_FIELD2" => "abc {}", "def"; -/// // single argument can be a &str or a &[u8] or anything else satsfying AsRef<[u8]> +/// // single argument can be a &str or a &[u8] or anything else satisfying AsRef<[u8]> /// "MY_FIELD3" => CString::new("my string").unwrap().to_bytes(); /// // field names can also be dynamic /// GString::from("MY_FIELD4") => b"a binary string".to_owned(); From 61f206e385587a63da44a769169125e1e58f061d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 18 Nov 2025 11:50:39 +0200 Subject: [PATCH 05/14] ci: Only run glib-macros tests on stable Some of the tests are checking compiler errors and they might change between Rust versions. --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c68ba4215e72..27277751a139 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -116,6 +116,7 @@ jobs: run: cargo build --manifest-path glib-macros/Cargo.toml - name: "glib-macros: test" run: cargo test --manifest-path glib-macros/Cargo.toml + if: matrix.rust == 'stable' # glib-macros in 2 levels dependent - name: Check two levels glib dependent run: cargo check From 54fee36cec2fb0ba3211000fe75ace3c9442dd41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 24 Nov 2025 12:49:11 +0200 Subject: [PATCH 06/14] gio: Remove pointless, empty build.rs --- gio/Cargo.toml | 1 - gio/build.rs | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 gio/build.rs diff --git a/gio/Cargo.toml b/gio/Cargo.toml index b3e073bfa61f..190e85f30b84 100644 --- a/gio/Cargo.toml +++ b/gio/Cargo.toml @@ -4,7 +4,6 @@ keywords = ["glib", "gio", "gtk-rs", "gnome"] readme = "README.md" documentation = "https://gtk-rs.org/gtk-rs-core/stable/latest/docs/gio/" description = "Rust bindings for the Gio library" -build = "build.rs" authors.workspace = true edition.workspace = true exclude.workspace = true diff --git a/gio/build.rs b/gio/build.rs deleted file mode 100644 index ac09fb87faa4..000000000000 --- a/gio/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -// This whole build.rs file is required because of the `OUT_DIR` environment variable -// provided by cargo when a build file is present. -fn main() {} From 3ffa2f5ef437ff53239fb1f4f20a9fef3bf7f7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 21 Nov 2025 14:08:14 +0200 Subject: [PATCH 07/14] glib: Fix `Regex::match` API Errors are independent of the return value, which signals whether there was a match or not. No match is not an error. Also a match info is always provided unless there is an error. Fixes https://github.com/gtk-rs/gtk-rs-core/issues/1848 --- glib/src/regex.rs | 54 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/glib/src/regex.rs b/glib/src/regex.rs index 45fbad437ba2..d6608b5aa93a 100644 --- a/glib/src/regex.rs +++ b/glib/src/regex.rs @@ -117,8 +117,8 @@ impl Regex { &self, string: &'input GStr, match_options: RegexMatchFlags, - ) -> Option> { - self.match_all_full(string, 0, match_options).ok() + ) -> Result, crate::Error> { + self.match_all_full(string, 0, match_options) } #[doc(alias = "g_regex_match_all_full")] @@ -131,7 +131,7 @@ impl Regex { unsafe { let mut match_info = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::g_regex_match_all_full( + let res = ffi::g_regex_match_all_full( self.to_glib_none().0, string.to_glib_none().0, string.len() as _, @@ -140,10 +140,12 @@ impl Regex { &mut match_info, &mut error, ); - debug_assert_eq!(is_ok == crate::ffi::GFALSE, !error.is_null()); if error.is_null() { - Ok(from_glib_full(match_info)) + let match_info = MatchInfo::from_glib_full(match_info); + debug_assert_eq!(match_info.matches(), from_glib(res)); + Ok(match_info) } else { + debug_assert!(match_info.is_null()); Err(from_glib_full(error)) } } @@ -154,8 +156,8 @@ impl Regex { &self, string: &'input GStr, match_options: RegexMatchFlags, - ) -> Option> { - self.match_full(string, 0, match_options).ok() + ) -> Result, crate::Error> { + self.match_full(string, 0, match_options) } #[doc(alias = "g_regex_match_full")] @@ -168,7 +170,7 @@ impl Regex { unsafe { let mut match_info = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::g_regex_match_full( + let res = ffi::g_regex_match_full( self.to_glib_none().0, string.to_glib_none().0, string.len() as _, @@ -177,10 +179,12 @@ impl Regex { &mut match_info, &mut error, ); - debug_assert_eq!(is_ok == crate::ffi::GFALSE, !error.is_null()); if error.is_null() { - Ok(from_glib_full(match_info)) + let match_info = MatchInfo::from_glib_full(match_info); + debug_assert_eq!(match_info.matches(), from_glib(res)); + Ok(match_info) } else { + debug_assert!(match_info.is_null()); Err(from_glib_full(error)) } } @@ -317,4 +321,34 @@ mod tests { assert_eq!(result[1], " "); assert_eq!(result[2], "."); } + + #[test] + fn test_match() { + let regex = glib::Regex::new( + r"\d", + glib::RegexCompileFlags::DEFAULT, + glib::RegexMatchFlags::DEFAULT, + ) + .expect("Regex new") + .expect("Null regex"); + + // This works (matches) + let input = glib::GString::from("87"); + let m = regex.match_(input.as_gstr(), glib::RegexMatchFlags::DEFAULT); + let m = m.unwrap(); + assert!(m.matches()); + assert_eq!(m.match_count(), 1); + assert_eq!(m.fetch(0).as_deref(), Some("8")); + assert!(m.next().unwrap()); + assert_eq!(m.fetch(0).as_deref(), Some("7")); + assert!(!m.next().unwrap()); + assert!(m.fetch(0).is_none()); + + let input = glib::GString::from("a"); + let m = regex.match_(input.as_gstr(), glib::RegexMatchFlags::DEFAULT); + let m = m.unwrap(); + assert!(!m.matches()); + assert_eq!(m.match_count(), 0); + assert!(m.fetch(0).is_none()); + } } From e7e3e6ff044f644517d966c3c0273ca1ab56050e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 21 Nov 2025 14:09:16 +0200 Subject: [PATCH 08/14] glib: Add some missing debug assertions to the `Regex` API --- glib/src/regex.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/glib/src/regex.rs b/glib/src/regex.rs index d6608b5aa93a..403bac413509 100644 --- a/glib/src/regex.rs +++ b/glib/src/regex.rs @@ -102,6 +102,7 @@ impl Regex { match_options.into_glib(), &mut error, ); + debug_assert_eq!(ret.is_null(), !error.is_null()); if error.is_null() { Ok(from_glib_full(ret)) } else { @@ -211,6 +212,7 @@ impl Regex { match_options.into_glib(), &mut error, ); + debug_assert_eq!(ret.is_null(), !error.is_null()); if error.is_null() { Ok(from_glib_full(ret)) } else { @@ -251,6 +253,7 @@ impl Regex { max_tokens, &mut error, ); + debug_assert_eq!(ret.is_null(), !error.is_null()); if error.is_null() { Ok(FromGlibPtrContainer::from_glib_full(ret)) } else { From 3f65b7c966a0d44be08bba6e7740287ed2244272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 25 Nov 2025 16:03:51 +0200 Subject: [PATCH 09/14] gio: Fix GSettings test Apparently cargo does not set `OUT_DIR` anymore for tests so let's use some random temporary directory instead. --- gio/src/settings.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gio/src/settings.rs b/gio/src/settings.rs index 5d5a638bd9f2..99114e7405ef 100644 --- a/gio/src/settings.rs +++ b/gio/src/settings.rs @@ -242,11 +242,13 @@ mod test { fn set_env() { INIT.call_once(|| { + let tmp_dir = glib::mkdtemp("gio-rs-test-schemas-XXXXXX").unwrap(); + let output = Command::new("glib-compile-schemas") .args([ &format!("{}/tests", env!("CARGO_MANIFEST_DIR")), "--targetdir", - env!("OUT_DIR"), + tmp_dir.to_str().unwrap(), ]) .output() .unwrap(); @@ -264,7 +266,7 @@ mod test { panic!("Can't test without GSchemas!"); } - set_var("GSETTINGS_SCHEMA_DIR", env!("OUT_DIR")); + set_var("GSETTINGS_SCHEMA_DIR", tmp_dir); set_var("GSETTINGS_BACKEND", "memory"); }); } From 47725e28ee4c9069eda769656759227edb28c92d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 25 Nov 2025 16:12:26 +0200 Subject: [PATCH 10/14] Remove `--cfg docsrs` from the Cargo.tomls --- cairo/Cargo.toml | 3 +-- cairo/sys/Cargo.toml | 3 +-- gdk-pixbuf/Cargo.toml | 3 +-- gdk-pixbuf/sys/Cargo.toml | 3 +-- gio/Cargo.toml | 3 +-- gio/sys/Cargo.toml | 3 +-- glib/Cargo.toml | 3 +-- glib/gobject-sys/Cargo.toml | 3 +-- glib/sys/Cargo.toml | 3 +-- graphene/Cargo.toml | 3 +-- graphene/sys/Cargo.toml | 3 +-- pango/Cargo.toml | 3 +-- pango/sys/Cargo.toml | 3 +-- pangocairo/Cargo.toml | 3 +-- pangocairo/sys/Cargo.toml | 3 +-- 15 files changed, 15 insertions(+), 30 deletions(-) diff --git a/cairo/Cargo.toml b/cairo/Cargo.toml index c9d531a0b8be..af4da4208811 100644 --- a/cairo/Cargo.toml +++ b/cairo/Cargo.toml @@ -48,5 +48,4 @@ float_eq = "1" [package.metadata.docs.rs] all-features = true -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/cairo/sys/Cargo.toml b/cairo/sys/Cargo.toml index d14c70774973..791e86a824f2 100644 --- a/cairo/sys/Cargo.toml +++ b/cairo/sys/Cargo.toml @@ -71,5 +71,4 @@ system-deps = "7" [package.metadata.docs.rs] all-features = true -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/gdk-pixbuf/Cargo.toml b/gdk-pixbuf/Cargo.toml index 6a0290ffc170..a82fe9e24158 100644 --- a/gdk-pixbuf/Cargo.toml +++ b/gdk-pixbuf/Cargo.toml @@ -32,5 +32,4 @@ gir-format-check.workspace = true [package.metadata.docs.rs] all-features = true -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/gdk-pixbuf/sys/Cargo.toml b/gdk-pixbuf/sys/Cargo.toml index e9a23507f3ea..8b5ec56033dd 100644 --- a/gdk-pixbuf/sys/Cargo.toml +++ b/gdk-pixbuf/sys/Cargo.toml @@ -69,6 +69,5 @@ version = "2.42" version = "2.43" [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 diff --git a/gio/Cargo.toml b/gio/Cargo.toml index 190e85f30b84..35cda478a455 100644 --- a/gio/Cargo.toml +++ b/gio/Cargo.toml @@ -53,5 +53,4 @@ serial_test = "3" [package.metadata.docs.rs] all-features = true -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/gio/sys/Cargo.toml b/gio/sys/Cargo.toml index d2b9807d80d5..5012feb486de 100644 --- a/gio/sys/Cargo.toml +++ b/gio/sys/Cargo.toml @@ -118,6 +118,5 @@ version = "2.84" version = "2.85" [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 diff --git a/glib/Cargo.toml b/glib/Cargo.toml index 97a11ccd7c9b..39aa54a7c67f 100644 --- a/glib/Cargo.toml +++ b/glib/Cargo.toml @@ -74,5 +74,4 @@ harness = false [package.metadata.docs.rs] all-features = true -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/glib/gobject-sys/Cargo.toml b/glib/gobject-sys/Cargo.toml index 5636d27b748c..9b6580989a77 100644 --- a/glib/gobject-sys/Cargo.toml +++ b/glib/gobject-sys/Cargo.toml @@ -103,6 +103,5 @@ version = "2.84" version = "2.85" [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 diff --git a/glib/sys/Cargo.toml b/glib/sys/Cargo.toml index 23caf11c4071..8058eeed3186 100644 --- a/glib/sys/Cargo.toml +++ b/glib/sys/Cargo.toml @@ -118,6 +118,5 @@ version = "2.58" version = "2.62" [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 diff --git a/graphene/Cargo.toml b/graphene/Cargo.toml index a44d2024a35f..d1930c61a346 100644 --- a/graphene/Cargo.toml +++ b/graphene/Cargo.toml @@ -29,5 +29,4 @@ gir-format-check.workspace = true [package.metadata.docs.rs] all-features = true -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/graphene/sys/Cargo.toml b/graphene/sys/Cargo.toml index 801d7fe64c91..4eac9b44e481 100644 --- a/graphene/sys/Cargo.toml +++ b/graphene/sys/Cargo.toml @@ -53,8 +53,7 @@ version = "1.10" version = "1.11" [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 [features] diff --git a/pango/Cargo.toml b/pango/Cargo.toml index 5aba93620432..d617cdb5b3a8 100644 --- a/pango/Cargo.toml +++ b/pango/Cargo.toml @@ -35,5 +35,4 @@ gir-format-check.workspace = true [package.metadata.docs.rs] all-features = true -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/pango/sys/Cargo.toml b/pango/sys/Cargo.toml index 46cfab8d3bbb..15c178832eaf 100644 --- a/pango/sys/Cargo.toml +++ b/pango/sys/Cargo.toml @@ -90,6 +90,5 @@ version = "1.55" version = "1.57" [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 diff --git a/pangocairo/Cargo.toml b/pangocairo/Cargo.toml index 847e4e08de2f..12538c18df8b 100644 --- a/pangocairo/Cargo.toml +++ b/pangocairo/Cargo.toml @@ -25,5 +25,4 @@ gir-format-check.workspace = true [package.metadata.docs.rs] all-features = true -rustc-args = ["--cfg", "docsrs"] -rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/pangocairo/sys/Cargo.toml b/pangocairo/sys/Cargo.toml index 3bfa7332b017..6de4584e62fa 100644 --- a/pangocairo/sys/Cargo.toml +++ b/pangocairo/sys/Cargo.toml @@ -55,8 +55,7 @@ name = "pangocairo" version = "1.40" [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 [features] From 058e3c4b99648cbf223948c6efefa4341cdb92cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 25 Nov 2025 16:13:29 +0200 Subject: [PATCH 11/14] Update docs.rs hacks in cairo-sys build.rs --- cairo/README.md | 4 ---- cairo/sys/build.rs | 14 ++++++-------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/cairo/README.md b/cairo/README.md index ee97c107dd26..c67ad7e60193 100644 --- a/cairo/README.md +++ b/cairo/README.md @@ -40,10 +40,6 @@ Currently, the minimum supported Rust version is `1.83.0`. * **win32-surface** - Microsoft Windows surface support -## Documentation rustdoc attributes - - * **docsrs** - Used to keep system dependent items in documentation - ## Using We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs), diff --git a/cairo/sys/build.rs b/cairo/sys/build.rs index 28d2512fe1be..c47ddb2419ca 100644 --- a/cairo/sys/build.rs +++ b/cairo/sys/build.rs @@ -1,13 +1,11 @@ -#[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); } } From 266741be542642e8f06f8632d214f94400278dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 25 Nov 2025 16:19:17 +0200 Subject: [PATCH 12/14] Don't pass `--cfg docsrs` via RUSTFLAGS on the CI Only via RUSTDOCFLAGS. --- .github/workflows/docs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 21117322fd57..269cc173158b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,7 +22,6 @@ jobs: 0.17=0.17 0.16=0.16 0.15=0.15 - RUSTFLAGS: --cfg docsrs RUSTDOCFLAGS: --cfg docsrs -Zunstable-options --generate-link-to-definition steps: - uses: actions/checkout@v4 From 1c7aa8ae43087a80558f6b923560f99f577f6ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 2 Dec 2025 11:13:28 +0200 Subject: [PATCH 13/14] Update Cargo.lock --- Cargo.lock | 84 +++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 804e823ed399..bae1fe748607 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,7 +101,7 @@ dependencies = [ "glib-sys", "libc", "system-deps", - "windows-sys 0.52.0", + "windows-sys 0.61.2", "x11", ] @@ -113,9 +113,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.43" +version = "1.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2" +checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a" dependencies = [ "find-msvc-tools", "shlex", @@ -166,18 +166,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.51" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.51" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" dependencies = [ "anstyle", "clap_lex", @@ -313,9 +313,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" [[package]] name = "float_eq" @@ -510,7 +510,7 @@ dependencies = [ "shell-words", "system-deps", "tempfile", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -638,9 +638,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" [[package]] name = "heck" @@ -650,9 +650,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" -version = "2.12.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", "hashbrown", @@ -675,9 +675,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.82" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" dependencies = [ "once_cell", "wasm-bindgen", @@ -691,9 +691,9 @@ checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libz-sys" -version = "1.1.22" +version = "1.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" +checksum = "15d118bbf3771060e7311cc7bb0545b01d08a8b4a7de949198dec1fa0ca1c0f7" dependencies = [ "cc", "libc", @@ -892,9 +892,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -1176,9 +1176,9 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "syn" -version = "2.0.108" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -1187,9 +1187,9 @@ dependencies = [ [[package]] name = "system-deps" -version = "7.0.6" +version = "7.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c236d79f20808ca0084bfcd1a2fd6c686216b7f7a0c4fc39deb0cbf5eaab3713" +checksum = "48c8f33736f986f16d69b6cb8b03f55ddcad5c41acc4ccc39dd88e84aa805e7f" dependencies = [ "cfg-expr", "heck", @@ -1322,9 +1322,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version-compare" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" [[package]] name = "walkdir" @@ -1353,9 +1353,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" dependencies = [ "cfg-if", "once_cell", @@ -1366,9 +1366,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1376,9 +1376,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" dependencies = [ "bumpalo", "proc-macro2", @@ -1389,18 +1389,18 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.105" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" -version = "0.3.82" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" +checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" dependencies = [ "js-sys", "wasm-bindgen", @@ -1524,9 +1524,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" dependencies = [ "memchr", ] @@ -1549,18 +1549,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.27" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.27" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", From 79df08b91ec982b7378802a3feb6e6a243b908cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 2 Dec 2025 11:19:31 +0200 Subject: [PATCH 14/14] glib: Clean up `Regex` tests --- glib/src/regex.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/glib/src/regex.rs b/glib/src/regex.rs index 403bac413509..f97104540e87 100644 --- a/glib/src/regex.rs +++ b/glib/src/regex.rs @@ -286,7 +286,6 @@ impl Regex { #[cfg(test)] mod tests { use super::*; - use crate::RegexCompileFlags; #[test] fn test_replace_literal() { @@ -327,17 +326,12 @@ mod tests { #[test] fn test_match() { - let regex = glib::Regex::new( - r"\d", - glib::RegexCompileFlags::DEFAULT, - glib::RegexMatchFlags::DEFAULT, - ) - .expect("Regex new") - .expect("Null regex"); + let regex = Regex::new(r"\d", RegexCompileFlags::DEFAULT, RegexMatchFlags::DEFAULT) + .expect("Regex new") + .expect("Null regex"); - // This works (matches) - let input = glib::GString::from("87"); - let m = regex.match_(input.as_gstr(), glib::RegexMatchFlags::DEFAULT); + let input = crate::GString::from("87"); + let m = regex.match_(input.as_gstr(), RegexMatchFlags::DEFAULT); let m = m.unwrap(); assert!(m.matches()); assert_eq!(m.match_count(), 1); @@ -347,8 +341,8 @@ mod tests { assert!(!m.next().unwrap()); assert!(m.fetch(0).is_none()); - let input = glib::GString::from("a"); - let m = regex.match_(input.as_gstr(), glib::RegexMatchFlags::DEFAULT); + let input = crate::GString::from("a"); + let m = regex.match_(input.as_gstr(), RegexMatchFlags::DEFAULT); let m = m.unwrap(); assert!(!m.matches()); assert_eq!(m.match_count(), 0);