diff --git a/crates/matrix-sdk-base/Cargo.toml b/crates/matrix-sdk-base/Cargo.toml index 4243806ff55..7373797a9e3 100644 --- a/crates/matrix-sdk-base/Cargo.toml +++ b/crates/matrix-sdk-base/Cargo.toml @@ -27,6 +27,11 @@ experimental-sliding-sync = [ ] uniffi = ["dep:uniffi", "matrix-sdk-crypto?/uniffi", "matrix-sdk-common/uniffi"] +# Private feature, see +# https://github.com/matrix-org/matrix-rust-sdk/pull/3749#issuecomment-2312939823 for the gory +# details. +test-send-sync = [] + # "message-ids" feature doesn't do anything and is deprecated. message-ids = [] diff --git a/crates/matrix-sdk-base/src/rooms/normal.rs b/crates/matrix-sdk-base/src/rooms/normal.rs index 7028e88d01d..0d08370cd8c 100644 --- a/crates/matrix-sdk-base/src/rooms/normal.rs +++ b/crates/matrix-sdk-base/src/rooms/normal.rs @@ -992,6 +992,23 @@ impl Room { } } +// See https://github.com/matrix-org/matrix-rust-sdk/pull/3749#issuecomment-2312939823. +#[cfg(not(feature = "test-send-sync"))] +unsafe impl Send for Room {} + +// See https://github.com/matrix-org/matrix-rust-sdk/pull/3749#issuecomment-2312939823. +#[cfg(not(feature = "test-send-sync"))] +unsafe impl Sync for Room {} + +#[cfg(feature = "test-send-sync")] +#[test] +// See https://github.com/matrix-org/matrix-rust-sdk/pull/3749#issuecomment-2312939823. +fn test_send_sync_for_room() { + fn assert_send_sync() {} + + assert_send_sync::(); +} + /// The underlying pure data structure for joined and left rooms. /// /// Holds all the info needed to persist a room into the state store. diff --git a/xtask/src/ci.rs b/xtask/src/ci.rs index 56ac0f9a679..4507baf44c1 100644 --- a/xtask/src/ci.rs +++ b/xtask/src/ci.rs @@ -293,7 +293,7 @@ fn run_wasm_checks(cmd: Option) -> Result<()> { WasmFeatureSet::MatrixSdkNoDefault, "-p matrix-sdk --no-default-features --features js,rustls-tls", ), - (WasmFeatureSet::MatrixSdkBase, "-p matrix-sdk-base --features js"), + (WasmFeatureSet::MatrixSdkBase, "-p matrix-sdk-base --features js,test-send-sync"), (WasmFeatureSet::MatrixSdkCommon, "-p matrix-sdk-common --features js"), ( WasmFeatureSet::MatrixSdkIndexeddbStoresNoCrypto,