From 6f9b4a989e27425b2a14f4a0a1c96637cd553b5e Mon Sep 17 00:00:00 2001 From: Ginger Date: Sun, 3 May 2026 08:55:50 -0400 Subject: [PATCH] fix: Update ctor macro arguments --- Cargo.lock | 16 ++++++++++++++++ Cargo.toml | 3 +++ src/admin/Cargo.toml | 1 + src/api/Cargo.toml | 1 + src/core/Cargo.toml | 1 + src/core/alloc/je.rs | 2 +- src/core/debug.rs | 2 +- src/database/Cargo.toml | 1 + src/macros/build_info.rs | 4 ++-- src/main/Cargo.toml | 1 + src/router/Cargo.toml | 1 + src/service/Cargo.toml | 1 + 12 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 669c02774..59f5291fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -975,6 +975,7 @@ dependencies = [ "console-subscriber", "const-str", "ctor", + "dtor", "hardened_malloc-rs", "log", "opentelemetry", @@ -1008,6 +1009,7 @@ dependencies = [ "conduwuit_service", "const-str", "ctor", + "dtor", "futures", "lettre", "log", @@ -1035,6 +1037,7 @@ dependencies = [ "conduwuit_service", "const-str", "ctor", + "dtor", "futures", "hmac", "http", @@ -1085,6 +1088,7 @@ dependencies = [ "core_affinity", "ctor", "cyborgtime", + "dtor", "either", "figment", "futures", @@ -1138,6 +1142,7 @@ dependencies = [ "conduwuit_macros", "const-str", "ctor", + "dtor", "futures", "log", "minicbor", @@ -1178,6 +1183,7 @@ dependencies = [ "conduwuit_web", "const-str", "ctor", + "dtor", "futures", "http", "http-body-util", @@ -1212,6 +1218,7 @@ dependencies = [ "conduwuit_macros", "const-str", "ctor", + "dtor", "either", "futures", "governor", @@ -1772,6 +1779,15 @@ dependencies = [ "litrs", ] +[[package]] +name = "dtor" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66261f2a6a4976b45407e398e63bc50a25fccf464d417f7d20f2e2b0974b9888" +dependencies = [ + "linktime-proc-macro", +] + [[package]] name = "dunce" version = "1.0.5" diff --git a/Cargo.toml b/Cargo.toml index 1f9fd61be..a3d10bb1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,9 @@ version = "1.1.0" [workspace.dependencies.ctor] version = "0.13.0" +[workspace.dependencies.dtor] +version = "0.13.0" + [workspace.dependencies.cargo_toml] version = "0.22" default-features = false diff --git a/src/admin/Cargo.toml b/src/admin/Cargo.toml index 9a93608b7..4afed12b4 100644 --- a/src/admin/Cargo.toml +++ b/src/admin/Cargo.toml @@ -81,6 +81,7 @@ conduwuit-macros.workspace = true conduwuit-service.workspace = true const-str.workspace = true ctor.workspace = true +dtor.workspace = true futures.workspace = true lettre.workspace = true log.workspace = true diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml index 07ecb7a1d..16537ec98 100644 --- a/src/api/Cargo.toml +++ b/src/api/Cargo.toml @@ -77,6 +77,7 @@ conduwuit-macros.workspace = true conduwuit-service.workspace = true const-str.workspace = true ctor.workspace = true +dtor.workspace = true futures.workspace = true hmac.workspace = true http.workspace = true diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml index 44fdeb61d..093b50f71 100644 --- a/src/core/Cargo.toml +++ b/src/core/Cargo.toml @@ -70,6 +70,7 @@ conduwuit-build-metadata.workspace = true const-str.workspace = true core_affinity.workspace = true ctor.workspace = true +dtor.workspace = true cyborgtime.workspace = true either.workspace = true figment.workspace = true diff --git a/src/core/alloc/je.rs b/src/core/alloc/je.rs index 96f1726a5..deb5ef726 100644 --- a/src/core/alloc/je.rs +++ b/src/core/alloc/je.rs @@ -47,7 +47,7 @@ type Key = ArrayVec; const NAME_MAX: usize = 128; const KEY_SEGS: usize = 8; -#[ctor::ctor] +#[ctor::ctor(unsafe)] fn _static_initialization() { acq_epoch().expect("pre-initialization of jemalloc failed"); acq_epoch().expect("pre-initialization of jemalloc failed"); diff --git a/src/core/debug.rs b/src/core/debug.rs index 6e1613585..eda1df6c4 100644 --- a/src/core/debug.rs +++ b/src/core/debug.rs @@ -62,7 +62,7 @@ pub const INFO_SPAN_LEVEL: Level = if cfg!(debug_assertions) { pub static DEBUGGER: LazyLock = LazyLock::new(|| env::var("_").unwrap_or_default().ends_with("gdb")); -#[cfg_attr(debug_assertions, ctor::ctor)] +#[cfg_attr(debug_assertions, ctor::ctor(unsafe))] #[cfg_attr(not(debug_assertions), allow(dead_code))] fn set_panic_trap() { if !*DEBUGGER { diff --git a/src/database/Cargo.toml b/src/database/Cargo.toml index a32be35eb..6b04c624d 100644 --- a/src/database/Cargo.toml +++ b/src/database/Cargo.toml @@ -58,6 +58,7 @@ conduwuit-core.workspace = true conduwuit-macros.workspace = true const-str.workspace = true ctor.workspace = true +dtor.workspace = true futures.workspace = true log.workspace = true minicbor.workspace = true diff --git a/src/macros/build_info.rs b/src/macros/build_info.rs index 10d99d2d3..801fb8bf0 100644 --- a/src/macros/build_info.rs +++ b/src/macros/build_info.rs @@ -32,11 +32,11 @@ pub(super) fn introspect(_args: TokenStream) -> Result { const CRATE_NAME: &str = #crate_name; /// Register this crate's features with the global registry during static initialization - #[::ctor::ctor] + #[::ctor::ctor(unsafe)] fn register() { conduwuit_core::info::introspection::ENABLED_FEATURES.lock().unwrap().insert(#crate_name, &ENABLED); } - #[::ctor::dtor] + #[::dtor::dtor(unsafe)] fn unregister() { conduwuit_core::info::introspection::ENABLED_FEATURES.lock().unwrap().remove(#crate_name); } diff --git a/src/main/Cargo.toml b/src/main/Cargo.toml index 8792add31..d3ae79c30 100644 --- a/src/main/Cargo.toml +++ b/src/main/Cargo.toml @@ -217,6 +217,7 @@ conduwuit-macros.workspace = true clap.workspace = true ctor.workspace = true +dtor.workspace = true console-subscriber.optional = true console-subscriber.workspace = true const-str.workspace = true diff --git a/src/router/Cargo.toml b/src/router/Cargo.toml index fcf41e104..6dfed9947 100644 --- a/src/router/Cargo.toml +++ b/src/router/Cargo.toml @@ -105,6 +105,7 @@ conduwuit-service.workspace = true conduwuit-web.workspace = true const-str.workspace = true ctor.workspace = true +dtor.workspace = true futures.workspace = true http.workspace = true http-body-util.workspace = true diff --git a/src/service/Cargo.toml b/src/service/Cargo.toml index 885d8dbb6..0a886d469 100644 --- a/src/service/Cargo.toml +++ b/src/service/Cargo.toml @@ -89,6 +89,7 @@ conduwuit-database.workspace = true conduwuit-macros.workspace = true const-str.workspace = true ctor.workspace = true +dtor.workspace = true either.workspace = true futures.workspace = true governor.workspace = true