From e7284b2b87a318dab066adcb04136a54b317def7 Mon Sep 17 00:00:00 2001 From: Noa Date: Wed, 9 Sep 2026 12:48:58 -0500 Subject: [PATCH 1/4] Add rust-toolchain-sync.sh --- .github/workflows/benchmarks.yml | 1 + crates/bench/Dockerfile | 2 +- crates/standalone/Dockerfile | 1 + rust-toolchain.toml | 5 ++--- tools/rust-toolchain-sync.sh | 20 ++++++++++++++++++++ 5 files changed, 25 insertions(+), 4 deletions(-) create mode 100755 tools/rust-toolchain-sync.sh diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 2c69e0ef06e..a08a650e3f5 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -184,6 +184,7 @@ jobs: runs-on: spacetimedb-linux timeout-minutes: 20 # on a successful run, runs in 8 minutes container: + # !rust-toolchain-sync image: rust:1.93.0 options: --privileged # disable until we fix the benchmarks diff --git a/crates/bench/Dockerfile b/crates/bench/Dockerfile index 0f64f819c82..4559c71b88a 100644 --- a/crates/bench/Dockerfile +++ b/crates/bench/Dockerfile @@ -2,7 +2,7 @@ # Set up to run from linux / WSL (running from a windows file system will be extremely slow). # See the README for commands to run. -# sync with: ../../rust-toolchain.toml +# !rust-toolchain-sync FROM rust:1.93.0 RUN apt-get update && \ diff --git a/crates/standalone/Dockerfile b/crates/standalone/Dockerfile index fa74fa1f232..0f4515ad25b 100644 --- a/crates/standalone/Dockerfile +++ b/crates/standalone/Dockerfile @@ -1,6 +1,7 @@ ARG CARGO_PROFILE=release +# !rust-toolchain-sync FROM rust:1.93.0 AS chef RUN rust_target=$(rustc -vV | awk '/^host:/{ print $2 }') && \ curl https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$rust_target.tgz -fL | tar xz -C $CARGO_HOME/bin diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 28f0403f3d4..9b425e79c6d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,6 @@ [toolchain] -# change crates/{standalone,bench}/Dockerfile, .github/Dockerfile, and the docker image tag in -# .github/workflows/benchmarks.yml:jobs/callgrind_benchmark/container/image -# maybe also the rust-version in Cargo.toml +# run ./tools/rust-toolchain-sync.sh when you change the channel! +# also consider changing the rust-version in Cargo.toml channel = "1.93.0" profile = "default" targets = ["wasm32-unknown-unknown"] diff --git a/tools/rust-toolchain-sync.sh b/tools/rust-toolchain-sync.sh new file mode 100755 index 00000000000..bad777a5a2a --- /dev/null +++ b/tools/rust-toolchain-sync.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -euo pipefail + +VERSION_REGEX="[0-9]+\.[0-9]+\.[0-9]+" +MAGIC_COMMENT="!rust-toolchain-sync" + +REPO_ROOT="$(dirname "$0")/.." + +TOOLCHAIN_FILE="${1:-$REPO_ROOT/rust-toolchain.toml}" +[[ $# -ge 1 ]] && shift + +toolchain="$(rg -o "channel = \"($VERSION_REGEX)\"" -r '$1' "$TOOLCHAIN_FILE")" || { + echo >&2 "$0: couldn't extract version from rust-toolchain.toml" + exit 1 +} + +rg -.F "$MAGIC_COMMENT" -l "$@" | xargs gawk -i inplace -v toolchain_ver="$toolchain" " +/$MAGIC_COMMENT/ { version = 1; print; next } +{ if (version) { gsub(/$VERSION_REGEX/, toolchain_ver); version = 0; } print } +" From 7fd2a9514ee6fe37dc2bbcff743e1542a524334c Mon Sep 17 00:00:00 2001 From: Noa Date: Wed, 9 Sep 2026 12:59:39 -0500 Subject: [PATCH 2/4] Bump rust toolchain to 1.98.1 --- .github/workflows/benchmarks.yml | 2 +- Cargo.toml | 2 +- crates/bench/Dockerfile | 2 +- crates/standalone/Dockerfile | 2 +- rust-toolchain.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index a08a650e3f5..89c9fa7c21c 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -185,7 +185,7 @@ jobs: timeout-minutes: 20 # on a successful run, runs in 8 minutes container: # !rust-toolchain-sync - image: rust:1.93.0 + image: rust:1.98.1 options: --privileged # disable until we fix the benchmarks if: false diff --git a/Cargo.toml b/Cargo.toml index a2b27d448c4..202d316990e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -144,7 +144,7 @@ debug = true version = "2.10.1" edition = "2024" # update rust-toolchain.toml too! -rust-version = "1.93.0" +rust-version = "1.98.1" [workspace.dependencies] spacetimedb = { path = "crates/bindings", version = "=2.10.1" } diff --git a/crates/bench/Dockerfile b/crates/bench/Dockerfile index 4559c71b88a..64919db3aae 100644 --- a/crates/bench/Dockerfile +++ b/crates/bench/Dockerfile @@ -3,7 +3,7 @@ # See the README for commands to run. # !rust-toolchain-sync -FROM rust:1.93.0 +FROM rust:1.98.1 RUN apt-get update && \ apt-get install -y valgrind bash && \ diff --git a/crates/standalone/Dockerfile b/crates/standalone/Dockerfile index 0f4515ad25b..1a9cfa1aaba 100644 --- a/crates/standalone/Dockerfile +++ b/crates/standalone/Dockerfile @@ -2,7 +2,7 @@ ARG CARGO_PROFILE=release # !rust-toolchain-sync -FROM rust:1.93.0 AS chef +FROM rust:1.98.1 AS chef RUN rust_target=$(rustc -vV | awk '/^host:/{ print $2 }') && \ curl https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$rust_target.tgz -fL | tar xz -C $CARGO_HOME/bin RUN cargo binstall -y cargo-chef@0.1.70 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 9b425e79c6d..7676abe47ec 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ [toolchain] # run ./tools/rust-toolchain-sync.sh when you change the channel! # also consider changing the rust-version in Cargo.toml -channel = "1.93.0" +channel = "1.98.1" profile = "default" targets = ["wasm32-unknown-unknown"] components = ["rust-src"] From a525178c8b6b4f5569d2061cb7eb765c39595018 Mon Sep 17 00:00:00 2001 From: Noa Date: Wed, 9 Sep 2026 13:05:53 -0500 Subject: [PATCH 3/4] Fix clippy lints --- crates/cli/src/subcommands/dev.rs | 2 +- crates/cli/src/subcommands/repl.rs | 2 +- crates/codegen/src/unrealcpp.rs | 2 +- crates/commitlog/src/segment.rs | 2 +- crates/core/src/host/instance_env.rs | 2 +- crates/core/src/host/v8/error.rs | 2 +- .../datastore/src/locking_tx_datastore/datastore.rs | 5 ++--- crates/engine/src/relational_db.rs | 11 ++++------- crates/engine/src/update.rs | 4 ++-- crates/pg/src/pg_server.rs | 1 + crates/schema/src/def.rs | 1 + crates/schema/src/def/validate/v10.rs | 2 +- crates/sqltest/src/main.rs | 12 ++++-------- tools/ci/commands/update-flow/src/main.rs | 2 +- tools/release/src/crates_resolver.rs | 4 ++-- tools/release/src/targets/docker.rs | 2 +- tools/xtask-llm-benchmark/src/bin/llm_benchmark.rs | 2 +- tools/xtask-llm-benchmark/src/context/combine.rs | 2 +- 18 files changed, 27 insertions(+), 33 deletions(-) diff --git a/crates/cli/src/subcommands/dev.rs b/crates/cli/src/subcommands/dev.rs index 95cc579182f..d24344b6490 100644 --- a/crates/cli/src/subcommands/dev.rs +++ b/crates/cli/src/subcommands/dev.rs @@ -1270,7 +1270,7 @@ async fn select_database(config: &Config, server: &str, token: &str) -> Result = stream::iter(result.identities.into_iter()) + let databases: Vec = stream::iter(result.identities) .map(|identity_str| { let config = config.clone(); async move { diff --git a/crates/cli/src/subcommands/repl.rs b/crates/cli/src/subcommands/repl.rs index 6561475ca92..9e4d7e5b50d 100644 --- a/crates/cli/src/subcommands/repl.rs +++ b/crates/cli/src/subcommands/repl.rs @@ -61,7 +61,7 @@ pub(crate) async fn exec(con: Connection, format: Format) -> Result<(), anyhow:: let api = ClientApi::new(con); loop { - let readline = rl.readline(&format!("🪐{}>", &database).green()); + let readline = rl.readline(&format!("🪐{}>", database).green()); match readline { Ok(line) => match line.as_str() { ".exit" => break, diff --git a/crates/codegen/src/unrealcpp.rs b/crates/codegen/src/unrealcpp.rs index a521e739180..f5d03e3f3de 100644 --- a/crates/codegen/src/unrealcpp.rs +++ b/crates/codegen/src/unrealcpp.rs @@ -416,7 +416,7 @@ impl Lang for UnrealCpp<'_> { let name = type_ref_name(self.module_prefix, module, typ.ty); let filename = format!( "Source/{}/Public/ModuleBindings/Types/{}Type.g.h", - self.module_name, &name + self.module_name, name ); let code: String = match &module.typespace_for_generate()[typ.ty] { AlgebraicTypeDef::PlainEnum(plain_enum) => autogen_cpp_enum(&name, plain_enum), diff --git a/crates/commitlog/src/segment.rs b/crates/commitlog/src/segment.rs index c810e2399ae..c67246f8cf3 100644 --- a/crates/commitlog/src/segment.rs +++ b/crates/commitlog/src/segment.rs @@ -16,7 +16,7 @@ use crate::{ Options, }; -pub const MAGIC: [u8; 6] = [b'(', b'd', b's', b')', b'^', b'2']; +pub const MAGIC: [u8; 6] = *b"(ds)^2"; pub const DEFAULT_LOG_FORMAT_VERSION: u8 = 1; pub const DEFAULT_CHECKSUM_ALGORITHM: u8 = CHECKSUM_ALGORITHM_CRC32C; diff --git a/crates/core/src/host/instance_env.rs b/crates/core/src/host/instance_env.rs index 97609d60bb3..76f605d2244 100644 --- a/crates/core/src/host/instance_env.rs +++ b/crates/core/src/host/instance_env.rs @@ -406,7 +406,7 @@ impl InstanceEnv { /// End a console timer by logging the span at INFO level. pub(crate) fn console_timer_end(&self, span: &TimingSpan, function: Option<&str>) { let elapsed = span.start.elapsed(); - let message = format!("Timing span {:?}: {:?}", &span.name, elapsed); + let message = format!("Timing span {:?}: {:?}", span.name, elapsed); self.console_log_simple_message(LogLevel::Info, function, &message); } diff --git a/crates/core/src/host/v8/error.rs b/crates/core/src/host/v8/error.rs index 54095f657cf..aa462506bef 100644 --- a/crates/core/src/host/v8/error.rs +++ b/crates/core/src/host/v8/error.rs @@ -520,7 +520,7 @@ impl fmt::Display for JsStackTraceFrame { // TODO(v8): make it more like chrome in the future. f.write_fmt(format_args!( "at {} ({}:{}:{})", - fn_name, script_name, &self.line, &self.column + fn_name, script_name, self.line, self.column ))?; if self.is_ctor { diff --git a/crates/datastore/src/locking_tx_datastore/datastore.rs b/crates/datastore/src/locking_tx_datastore/datastore.rs index 1082e0ae9c6..205de3567fe 100644 --- a/crates/datastore/src/locking_tx_datastore/datastore.rs +++ b/crates/datastore/src/locking_tx_datastore/datastore.rs @@ -229,9 +229,8 @@ impl Locking { /// error. pub fn take_snapshot(&self, repo: &DynSnapshotRepo) -> Result> { Self::take_snapshot_internal(&self.committed_state, repo)? - .map(|(_offset, snap)| snap.sync_all()) + .map(|(_offset, snap)| snap.sync_all().map_err(Into::into)) .transpose() - .map_err(Into::into) } pub fn assert_system_tables_match(&self) -> Result<()> { @@ -3021,7 +3020,7 @@ pub(crate) mod tests { fn assert_rows(datastore: &Locking, table_id: TableId, rows: Vec) -> ResultTest<()> { let tx = begin_tx(datastore); - for (actual, expected) in datastore.iter_tx(&tx, table_id)?.zip_eq(rows.into_iter()) { + for (actual, expected) in datastore.iter_tx(&tx, table_id)?.zip_eq(rows) { assert_eq!(actual.to_bsatn_vec()?, expected.to_bsatn_vec()?); } Ok(()) diff --git a/crates/engine/src/relational_db.rs b/crates/engine/src/relational_db.rs index 19cda5b6fbe..800148f9251 100644 --- a/crates/engine/src/relational_db.rs +++ b/crates/engine/src/relational_db.rs @@ -627,13 +627,10 @@ impl RelationalDB { // Try to restore from any snapshot that was taken within the // range `(min_commitlog_offset + 1)..=durable_tx_offset`. let mut upper_bound = durable_tx_offset; - loop { - let Some(snapshot_offset) = snapshot_repo - .latest_snapshot_older_than(upper_bound) - .map_err(Box::new)? - else { - break; - }; + while let Some(snapshot_offset) = snapshot_repo + .latest_snapshot_older_than(upper_bound) + .map_err(Box::new)? + { if min_commitlog_offset > 0 && min_commitlog_offset > snapshot_offset + 1 { log::debug!("snapshot_offset={snapshot_offset} min_commitlog_offset={min_commitlog_offset}"); break; diff --git a/crates/engine/src/update.rs b/crates/engine/src/update.rs index 5b9e6e0fde2..ab864688d1c 100644 --- a/crates/engine/src/update.rs +++ b/crates/engine/src/update.rs @@ -705,7 +705,7 @@ pub fn create_table_from_view_def( view_def: &ViewDef, ) -> anyhow::Result<()> { stdb.create_view(tx, module_def, view_def) - .with_context(|| format!("failed to create table for view {}", &view_def.name))?; + .with_context(|| format!("failed to create table for view {}", view_def.name))?; Ok(()) } @@ -719,7 +719,7 @@ pub fn create_table_from_view_def_with_prefix( name_prefix: &NamespacePath, ) -> anyhow::Result<()> { stdb.create_view_with_prefix(tx, owning_def, view_def, name_prefix) - .with_context(|| format!("failed to create table for view {}{}", name_prefix, &view_def.name))?; + .with_context(|| format!("failed to create table for view {}{}", name_prefix, view_def.name))?; Ok(()) } diff --git a/crates/pg/src/pg_server.rs b/crates/pg/src/pg_server.rs index f1de39f4efd..361da919418 100644 --- a/crates/pg/src/pg_server.rs +++ b/crates/pg/src/pg_server.rs @@ -157,6 +157,7 @@ where let params = self.cached.lock().await.clone().unwrap(); let name_or_identity = database::NameOrIdentity::Name(DatabaseName(params.database.clone())); let database_identity = response(name_or_identity.resolve(&self.ctx).await, ¶ms.database).await?; + #[expect(clippy::result_large_err)] let database = response( self.ctx .get_database_by_identity(&database_identity) diff --git a/crates/schema/src/def.rs b/crates/schema/src/def.rs index e324d93b0ea..455f2e37235 100644 --- a/crates/schema/src/def.rs +++ b/crates/schema/src/def.rs @@ -1362,6 +1362,7 @@ impl TableDef { impl From for RawTableDefV9 { fn from(val: TableDef) -> Self { + #[expect(clippy::unneeded_wildcard_pattern)] let TableDef { name, product_type_ref, diff --git a/crates/schema/src/def/validate/v10.rs b/crates/schema/src/def/validate/v10.rs index 11fbcf4e3d4..a57d56a9212 100644 --- a/crates/schema/src/def/validate/v10.rs +++ b/crates/schema/src/def/validate/v10.rs @@ -398,7 +398,7 @@ fn validate_submodules(submodules: Vec) -> Result errors.extend(e.into_iter()), + Err(e) => errors.extend(e), } } } diff --git a/crates/sqltest/src/main.rs b/crates/sqltest/src/main.rs index 7856008afd3..304042fc21c 100644 --- a/crates/sqltest/src/main.rs +++ b/crates/sqltest/src/main.rs @@ -449,15 +449,11 @@ async fn update_test_file { - if sql.contains("NOT_REWRITE") { - continue; - } + Record::Statement { sql, .. } if sql.contains("NOT_REWRITE") => { + continue; } - Record::Query { sql, .. } => { - if sql.contains("NOT_REWRITE") { - continue; - } + Record::Query { sql, .. } if sql.contains("NOT_REWRITE") => { + continue; } _ => (), } diff --git a/tools/ci/commands/update-flow/src/main.rs b/tools/ci/commands/update-flow/src/main.rs index 273e5f26efc..be9d99b8460 100644 --- a/tools/ci/commands/update-flow/src/main.rs +++ b/tools/ci/commands/update-flow/src/main.rs @@ -56,7 +56,7 @@ fn main() -> Result<()> { ["run", "-p", "spacetimedb-update"] .into_iter() .chain(common_args.clone()) - .chain(["--", "self-install", &root_arg, "--yes"].into_iter()), + .chain(["--", "self-install", &root_arg, "--yes"]), ) .run()?; diff --git a/tools/release/src/crates_resolver.rs b/tools/release/src/crates_resolver.rs index 3412ecf93da..158cfcc441c 100644 --- a/tools/release/src/crates_resolver.rs +++ b/tools/release/src/crates_resolver.rs @@ -72,9 +72,9 @@ pub fn get_crate_deps(crate_name: &String, manifest_map: &HashMap>) -> Option> = HashMap::new(); for g in groups { - out.entry(g.vendor).or_default().extend(g.models.into_iter()); + out.entry(g.vendor).or_default().extend(g.models); } Some(out) } diff --git a/tools/xtask-llm-benchmark/src/context/combine.rs b/tools/xtask-llm-benchmark/src/context/combine.rs index ac8eb278c1b..9c3b1a2f59f 100644 --- a/tools/xtask-llm-benchmark/src/context/combine.rs +++ b/tools/xtask-llm-benchmark/src/context/combine.rs @@ -163,7 +163,7 @@ fn build_context_from_rustdoc_json() -> Result { }); } - rows.sort_by(|a, b| (order_key(&a.kind), a.path.to_lowercase()).cmp(&(order_key(&b.kind), b.path.to_lowercase()))); + rows.sort_by_key(|a| (order_key(&a.kind), a.path.to_lowercase())); let mut out = String::with_capacity(1024 * 1024); out.push_str(&format!( From f3a724df52ae3d59d279f001add7679a94d0a5b7 Mon Sep 17 00:00:00 2001 From: Noa Date: Thu, 17 Sep 2026 12:14:25 -0500 Subject: [PATCH 4/4] Run cargo fmt --- crates/lib/src/lib.rs | 2 +- sdks/rust/src/db_connection.rs | 2 +- sdks/rust/src/spacetime_module.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/lib/src/lib.rs b/crates/lib/src/lib.rs index 55d5621a16d..0ee6395186b 100644 --- a/crates/lib/src/lib.rs +++ b/crates/lib/src/lib.rs @@ -40,12 +40,12 @@ pub use filterable_value::Private; pub use filterable_value::{FilterableValue, IndexScanRangeBoundsTerminator, TermBound, ViewPrimaryKeyColumn}; pub use identity::Identity; pub use scheduler::ScheduleAt; +pub use spacetimedb_sats::__make_register_reftype; pub use spacetimedb_sats::hash::{self, hash_bytes, Hash}; pub use spacetimedb_sats::time_duration::TimeDuration; pub use spacetimedb_sats::timestamp::Timestamp; pub use spacetimedb_sats::uuid::Uuid; pub use spacetimedb_sats::SpacetimeType; -pub use spacetimedb_sats::__make_register_reftype; pub use spacetimedb_sats::{self as sats, bsatn, buffer, de, ser}; pub use spacetimedb_sats::{AlgebraicType, ProductType, ProductTypeElement, SumType}; pub use spacetimedb_sats::{AlgebraicValue, ProductValue}; diff --git a/sdks/rust/src/db_connection.rs b/sdks/rust/src/db_connection.rs index 137166ae614..c1810f7e5dd 100644 --- a/sdks/rust/src/db_connection.rs +++ b/sdks/rust/src/db_connection.rs @@ -19,7 +19,6 @@ //! This module is internal, and may incompatibly change without warning. use crate::{ - Event, ReducerEvent, Status, __codegen::{InternalError, Reducer}, callbacks::{ CallbackId, DbCallbacks, ProcedureCallback, ProcedureCallbacks, ReducerCallback, ReducerCallbacks, RowCallback, @@ -29,6 +28,7 @@ use crate::{ spacetime_module::{AbstractEventContext, AppliedDiff, DbConnection, DbUpdate, InModule, SpacetimeModule}, subscription::{PendingUnsubscribeResult, SubscriptionHandleImpl, SubscriptionManager}, websocket::{WsConnection, WsParams}, + Event, ReducerEvent, Status, }; use bytes::Bytes; use futures::StreamExt; diff --git a/sdks/rust/src/spacetime_module.rs b/sdks/rust/src/spacetime_module.rs index dfec381e56d..cba7c73122b 100644 --- a/sdks/rust/src/spacetime_module.rs +++ b/sdks/rust/src/spacetime_module.rs @@ -3,12 +3,12 @@ //! This module is internal, and may incompatibly change without warning. use crate::{ + __codegen::InternalError, callbacks::DbCallbacks, client_cache::ClientCache, db_connection::DbContextImpl, subscription::{OnEndedCallback, SubscriptionHandleImpl}, Event, ReducerEvent, - __codegen::InternalError, }; use bytes::Bytes; use spacetimedb_client_api_messages::websocket::{self as ws, common::RowListLen as _, v2::BsatnRowList};