From 45dd8d093f3b6d54cbd0059ebd2b79ad7b17db64 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sun, 17 May 2026 18:53:49 +0200 Subject: [PATCH] LibRegex: Hide the Unicode allocator override behind a feature In a similar fashion to 46912fce8d0ab00f54f073b87a6b65989d97c521. In this case, a future commit will make LibURL depend on LibRegex's Rust module, so we need to apply the same change here too. --- Libraries/LibRegex/CMakeLists.txt | 2 +- Libraries/LibRegex/Rust/Cargo.toml | 4 ++++ Libraries/LibRegex/Rust/src/lib.rs | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/LibRegex/CMakeLists.txt b/Libraries/LibRegex/CMakeLists.txt index 5e53940616..26828179b1 100644 --- a/Libraries/LibRegex/CMakeLists.txt +++ b/Libraries/LibRegex/CMakeLists.txt @@ -5,7 +5,7 @@ set(SOURCES ladybird_lib(LibRegex regex EXPLICIT_SYMBOL_EXPORT) -import_rust_crate(MANIFEST_PATH Rust/Cargo.toml CRATE_NAME libregex_rust FFI_HEADER RustFFI.h) +import_rust_crate(MANIFEST_PATH Rust/Cargo.toml CRATE_NAME libregex_rust FEATURES allocator FFI_HEADER RustFFI.h) target_link_libraries(LibRegex PRIVATE libregex_rust LibUnicode) if ((LINUX OR BSD) AND NOT BUILD_SHARED_LIBS) target_link_options(LibRegex INTERFACE LINKER:--allow-multiple-definition) diff --git a/Libraries/LibRegex/Rust/Cargo.toml b/Libraries/LibRegex/Rust/Cargo.toml index e01db02dc1..bb79360247 100644 --- a/Libraries/LibRegex/Rust/Cargo.toml +++ b/Libraries/LibRegex/Rust/Cargo.toml @@ -11,5 +11,9 @@ crate-type = ["staticlib"] [dependencies] libunicode_rust = { path = "../../LibUnicode/Rust", default-features = false } +[features] +default = [] +allocator = [] + [build-dependencies] cbindgen = "0.29" diff --git a/Libraries/LibRegex/Rust/src/lib.rs b/Libraries/LibRegex/Rust/src/lib.rs index 594f9130d9..b8896cbdec 100644 --- a/Libraries/LibRegex/Rust/src/lib.rs +++ b/Libraries/LibRegex/Rust/src/lib.rs @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#[cfg(feature = "allocator")] #[path = "../../../RustAllocator.rs"] mod rust_allocator;