Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions .github/actions/android/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/wasm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/actions/xcframework/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 2 additions & 4 deletions crates/core/src/bson/de.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::assert_matches;
use serde::{
de::{
self, DeserializeSeed, EnumAccess, IntoDeserializer, MapAccess, SeqAccess, VariantAccess,
Expand Down Expand Up @@ -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!
Expand Down
3 changes: 2 additions & 1 deletion crates/core/src/bson/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub fn from_bytes<'de, T: Deserialize<'de>>(bytes: &'de [u8]) -> Result<T, BsonE
#[cfg(test)]
mod test {
use alloc::{vec, vec::Vec};
use core::assert_matches;

use crate::sync::line::{SyncLine, TokenExpiresIn};

Expand Down Expand Up @@ -52,7 +53,7 @@ mod test {
let bson = b"\x1b\x00\x00\x00\x10token_expires_in\x00<\x00\x00\x00\x00";

let expected: SyncLine = from_bytes(bson.as_slice()).expect("should deserialize");
assert!(matches!(expected, SyncLine::KeepAlive(TokenExpiresIn(60))))
assert_matches!(expected, SyncLine::KeepAlive(TokenExpiresIn(60)))
}

#[test]
Expand Down
3 changes: 2 additions & 1 deletion crates/core/src/fix_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ pub fn register(db: *mut sqlite::sqlite3) -> 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]
Expand Down
13 changes: 7 additions & 6 deletions crates/core/src/schema/raw_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion crates/core/src/schema/table_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
35 changes: 15 additions & 20 deletions crates/core/src/sync/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand All @@ -382,23 +383,23 @@ 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,
write_checkpoint: None,
buckets: _,
streams: _,
})
));
);

let SyncLine::Checkpoint(checkpoint) = deserialize(
r#"{"checkpoint": {"last_op_id": "10", "buckets": [{"bucket": "a", "checksum": 10}]}}"#,
Expand All @@ -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}]}}"#
),
Expand All @@ -434,7 +435,7 @@ mod tests {
buckets: _,
streams: _,
})
));
);
}

#[test]
Expand Down Expand Up @@ -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]
Expand All @@ -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: _,
Expand All @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions crates/loadable/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion crates/shell/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2025-12-05"
channel = "nightly-2026-04-10"
6 changes: 3 additions & 3 deletions tool/build_wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
simolus3 marked this conversation as resolved.

cp "target/wasm32-wasip1/wasm/libpowersync.a" "libpowersync-wasm.a"
cp "target/wasm32-unknown-unknown/wasm/libpowersync.a" "libpowersync-wasm.a"
Loading