diff --git a/.cargo/config.toml b/.cargo/config.toml index 87890bb2..b3fa5da9 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -22,6 +22,11 @@ rustflags = [ "-C", "link-arg=-lgcc_eh", ] +[target.'cfg(target_family = "wasm")'] +rustflags = [ + "-C", "link-arg=--allow-undefined", +] + [target.x86_64-unknown-linux-gnu] linker = "x86_64-linux-gnu-gcc" diff --git a/.github/actions/android/action.yml b/.github/actions/android/action.yml index e5b1601a..0603fafa 100644 --- a/.github/actions/android/action.yml +++ b/.github/actions/android/action.yml @@ -25,8 +25,8 @@ runs: - name: Setup shell: bash run: | - rustup toolchain install nightly-2025-12-05-x86_64-unknown-linux-gnu - rustup component add rust-src --toolchain nightly-2025-12-05-x86_64-unknown-linux-gnu + rustup toolchain install nightly-2026-04-10-x86_64-unknown-linux-gnu + rustup component add rust-src --toolchain nightly-2026-04-10-x86_64-unknown-linux-gnu rustup target add \ aarch64-linux-android \ armv7-linux-androideabi \ diff --git a/.github/actions/linux/action.yml b/.github/actions/linux/action.yml index d6101d12..8d64e654 100644 --- a/.github/actions/linux/action.yml +++ b/.github/actions/linux/action.yml @@ -7,7 +7,7 @@ runs: - name: Install Rust Nightly uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2025-12-05 + toolchain: nightly-2026-04-10 components: rust-src targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu,i686-unknown-linux-gnu,riscv64gc-unknown-linux-gnu,armv7-unknown-linux-gnueabihf diff --git a/.github/actions/macos/action.yml b/.github/actions/macos/action.yml index 233bcddc..797c1ad8 100644 --- a/.github/actions/macos/action.yml +++ b/.github/actions/macos/action.yml @@ -7,7 +7,7 @@ runs: - name: Install Rust Nightly uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2025-12-05 + toolchain: nightly-2026-04-10 components: rust-src targets: x86_64-apple-darwin,aarch64-apple-darwin diff --git a/.github/actions/wasm/action.yml b/.github/actions/wasm/action.yml index 900d9db3..d490c627 100644 --- a/.github/actions/wasm/action.yml +++ b/.github/actions/wasm/action.yml @@ -7,7 +7,7 @@ runs: - name: Install Rust Nightly uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2025-12-05 + toolchain: nightly-2026-04-10 components: rust-src - name: Setup emsdk diff --git a/.github/actions/windows/action.yml b/.github/actions/windows/action.yml index 5cda964c..1b1f2152 100644 --- a/.github/actions/windows/action.yml +++ b/.github/actions/windows/action.yml @@ -7,7 +7,7 @@ runs: - name: Install Rust Nightly uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2025-12-05 + toolchain: nightly-2026-04-10 components: rust-src targets: x86_64-pc-windows-msvc,aarch64-pc-windows-msvc,i686-pc-windows-msvc diff --git a/.github/actions/xcframework/action.yml b/.github/actions/xcframework/action.yml index 292f928d..54bf450c 100644 --- a/.github/actions/xcframework/action.yml +++ b/.github/actions/xcframework/action.yml @@ -7,8 +7,8 @@ runs: - name: Setup shell: bash run: | - rustup toolchain install nightly-2025-12-05-aarch64-apple-darwin - rustup component add rust-src --toolchain nightly-2025-12-05-aarch64-apple-darwin + rustup toolchain install nightly-2026-04-10-aarch64-apple-darwin + rustup component add rust-src --toolchain nightly-2026-04-10-aarch64-apple-darwin rustup target add \ x86_64-apple-darwin \ aarch64-apple-darwin \ diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c02ec5f7..fdf042f6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,7 +81,7 @@ jobs: - name: Install Rust Nightly uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2025-12-05 + toolchain: nightly-2026-04-10 components: rust-src,rustfmt,clippy - name: Check formatting @@ -201,7 +201,7 @@ jobs: - name: Install Rust Nightly uses: dtolnay/rust-toolchain@stable with: - toolchain: nightly-2025-12-05 + toolchain: nightly-2026-04-10 components: rust-src - name: Install valgrind diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index b10b9b23..001140ed 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -9,6 +9,7 @@ authors.workspace = true keywords.workspace = true description = "The PowerSync SQLite extension" readme = "README.md" +rust-version = "1.96" [lib] name = "powersync_core" diff --git a/crates/core/src/bson/de.rs b/crates/core/src/bson/de.rs index 6073d114..c66c7907 100644 --- a/crates/core/src/bson/de.rs +++ b/crates/core/src/bson/de.rs @@ -1,3 +1,4 @@ +use core::assert_matches; use serde::{ de::{ self, DeserializeSeed, EnumAccess, IntoDeserializer, MapAccess, SeqAccess, VariantAccess, @@ -248,10 +249,7 @@ impl<'de> SeqAccess<'de> for Deserializer<'de> { } // Skip name - assert!(matches!( - self.position, - DeserializerPosition::BeforeName { .. } - )); + assert_matches!(self.position, DeserializerPosition::BeforeName { .. }); self.prepare_to_read(true)?; // And deserialize value! diff --git a/crates/core/src/bson/mod.rs b/crates/core/src/bson/mod.rs index bbf77a40..92e7777c 100644 --- a/crates/core/src/bson/mod.rs +++ b/crates/core/src/bson/mod.rs @@ -16,6 +16,7 @@ pub fn from_bytes<'de, T: Deserialize<'de>>(bytes: &'de [u8]) -> Result Result<(), ResultCode> { mod test { use super::remove_duplicate_key_encoding; + use core::assert_matches; fn assert_unaffected(source: &str) { - assert!(matches!(remove_duplicate_key_encoding(source), None)); + assert_matches!(remove_duplicate_key_encoding(source), None); } #[test] diff --git a/crates/core/src/schema/raw_table.rs b/crates/core/src/schema/raw_table.rs index 63dba036..ee06501b 100644 --- a/crates/core/src/schema/raw_table.rs +++ b/crates/core/src/schema/raw_table.rs @@ -324,6 +324,7 @@ pub fn generate_raw_table_trigger( #[cfg(test)] mod test { use alloc::{string::ToString, vec}; + use core::assert_matches; use crate::schema::{PendingStatementValue, raw_table::InferredTableStructure}; @@ -340,19 +341,19 @@ mod test { r#"INSERT INTO "tbl" (id, "foo", "bar") VALUES (?1, ?2, ?3) ON CONFLICT (id) DO UPDATE SET "foo" = ?2, "bar" = ?3"# ); assert_eq!(put.params.len(), 3); - assert!(matches!(put.params[0], PendingStatementValue::Id)); - assert!(matches!( + assert_matches!(put.params[0], PendingStatementValue::Id); + assert_matches!( put.params[1], PendingStatementValue::Column(ref name) if name == "foo" - )); - assert!(matches!( + ); + assert_matches!( put.params[2], PendingStatementValue::Column(ref name) if name == "bar" - )); + ); let delete = structure.infer_delete_stmt(); assert_eq!(delete.sql, r#"DELETE FROM "tbl" WHERE id = ?"#); assert_eq!(delete.params.len(), 1); - assert!(matches!(delete.params[0], PendingStatementValue::Id)); + assert_matches!(delete.params[0], PendingStatementValue::Id); } } diff --git a/crates/core/src/schema/table_info.rs b/crates/core/src/schema/table_info.rs index ad0320d0..877ac8b0 100644 --- a/crates/core/src/schema/table_info.rs +++ b/crates/core/src/schema/table_info.rs @@ -357,7 +357,7 @@ impl<'de> Deserialize<'de> for PendingStatement { } } -#[derive(Deserialize)] +#[derive(Deserialize, Debug)] pub enum PendingStatementValue { /// Bind to the PowerSync row id of the affected row. Id, diff --git a/crates/core/src/sync/line.rs b/crates/core/src/sync/line.rs index 679e211b..a4151139 100644 --- a/crates/core/src/sync/line.rs +++ b/crates/core/src/sync/line.rs @@ -373,6 +373,7 @@ impl<'a, 'de: 'a> Deserialize<'de> for OplogData<'a> { mod tests { use alloc::string::ToString; + use core::assert_matches; use super::*; @@ -382,15 +383,15 @@ mod tests { #[test] fn parse_token_expires_in() { - assert!(matches!( + assert_matches!( deserialize(r#"{"token_expires_in": 123}"#), SyncLine::KeepAlive(TokenExpiresIn(123)) - )); + ); } #[test] fn parse_checkpoint() { - assert!(matches!( + assert_matches!( deserialize(r#"{"checkpoint": {"last_op_id": "10", "buckets": []}}"#), SyncLine::Checkpoint(Checkpoint { last_op_id: 10, @@ -398,7 +399,7 @@ mod tests { buckets: _, streams: _, }) - )); + ); let SyncLine::Checkpoint(checkpoint) = deserialize( r#"{"checkpoint": {"last_op_id": "10", "buckets": [{"bucket": "a", "checksum": 10}]}}"#, @@ -424,7 +425,7 @@ mod tests { assert_eq!(bucket.checksum, 10u32.into()); assert_eq!(bucket.priority, Some(BucketPriority { number: 1 })); - assert!(matches!( + assert_matches!( deserialize( r#"{"checkpoint":{"write_checkpoint":null,"last_op_id":"1","buckets":[{"bucket":"a","checksum":0,"priority":3,"count":1}]}}"# ), @@ -434,7 +435,7 @@ mod tests { buckets: _, streams: _, }) - )); + ); } #[test] @@ -471,23 +472,23 @@ mod tests { #[test] fn parse_checkpoint_complete() { - assert!(matches!( + assert_matches!( deserialize(r#"{"checkpoint_complete": {"last_op_id": "10"}}"#), SyncLine::CheckpointComplete(CheckpointComplete { // last_op_id: 10 }) - )); + ); } #[test] fn parse_checkpoint_partially_complete() { - assert!(matches!( + assert_matches!( deserialize(r#"{"partial_checkpoint_complete": {"last_op_id": "10", "priority": 1}}"#), SyncLine::CheckpointPartiallyComplete(CheckpointPartiallyComplete { //last_op_id: 10, priority: BucketPriority { number: 1 } }) - )); + ); } #[test] @@ -508,7 +509,7 @@ mod tests { assert_eq!(data.data.len(), 1); let entry = &data.data[0]; assert_eq!(entry.checksum, 10u32.into()); - assert!(matches!( + assert_matches!( &data.data[0], OplogEntry { checksum: _, @@ -519,19 +520,13 @@ mod tests { subkey: None, data: _, } - )); + ); } #[test] fn parse_unknown() { - assert!(matches!( - deserialize("{\"foo\": {}}"), - SyncLine::UnknownSyncLine - )); - assert!(matches!( - deserialize("{\"foo\": 123}"), - SyncLine::UnknownSyncLine - )); + assert_matches!(deserialize("{\"foo\": {}}"), SyncLine::UnknownSyncLine); + assert_matches!(deserialize("{\"foo\": 123}"), SyncLine::UnknownSyncLine); } #[test] diff --git a/crates/loadable/src/lib.rs b/crates/loadable/src/lib.rs index 2cab4c56..53e76347 100644 --- a/crates/loadable/src/lib.rs +++ b/crates/loadable/src/lib.rs @@ -1,7 +1,6 @@ #![no_std] #![allow(internal_features)] -#![cfg_attr(feature = "nightly", feature(core_intrinsics))] -#![cfg_attr(feature = "nightly", feature(lang_items))] +#![cfg_attr(feature = "nightly", feature(core_intrinsics, lang_items))] extern crate alloc; diff --git a/crates/shell/src/main.rs b/crates/shell/src/main.rs index 2e4983e4..43f58ec5 100644 --- a/crates/shell/src/main.rs +++ b/crates/shell/src/main.rs @@ -2,7 +2,7 @@ #![no_std] #![allow(internal_features)] #![feature(lang_items)] -#![feature(core_intrinsics)] +#![cfg_attr(not(test), feature(core_intrinsics))] use core::ffi::{c_char, c_int}; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b8ce6f81..feecada9 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2025-12-05" +channel = "nightly-2026-04-10" diff --git a/tool/build_wasm.sh b/tool/build_wasm.sh index cbf22850..72536a8f 100755 --- a/tool/build_wasm.sh +++ b/tool/build_wasm.sh @@ -32,13 +32,13 @@ cp "target/wasm32-unknown-emscripten/wasm_asyncify/powersync.wasm" "libpowersync # Static lib. # Works for both sync and asyncify builds. # Works for both emscripten and wasi. -# target/wasm32-wasip1/wasm/libpowersync.a +# target/wasm32-unknown-unknown/wasm/libpowersync.a cargo build \ -p powersync_loadable \ --profile wasm \ --no-default-features \ --features "static nightly" \ -Z build-std=panic_abort,core,alloc \ - --target wasm32-wasip1 + --target wasm32-unknown-unknown -cp "target/wasm32-wasip1/wasm/libpowersync.a" "libpowersync-wasm.a" +cp "target/wasm32-unknown-unknown/wasm/libpowersync.a" "libpowersync-wasm.a"