Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ jobs:
runs-on: spacetimedb-linux
timeout-minutes: 20 # on a successful run, runs in 8 minutes
container:
image: rust:1.93.0
# !rust-toolchain-sync
image: rust:1.98.1
options: --privileged
# disable until we fix the benchmarks
if: false
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,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" }
Expand Down
4 changes: 2 additions & 2 deletions crates/bench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# 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
FROM rust:1.93.0
# !rust-toolchain-sync
FROM rust:1.98.1

RUN apt-get update && \
apt-get install -y valgrind bash && \
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/subcommands/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ async fn select_database(config: &Config, server: &str, token: &str) -> Result<S
// Fetch database names with HTTP queries to /database/{identity}/names
// It's parallelyzed in case a user has a lot of databases
// TODO: we should introduce an endpoint that returns user's databases with names
let databases: Vec<DatabaseRow> = stream::iter(result.identities.into_iter())
let databases: Vec<DatabaseRow> = stream::iter(result.identities)
.map(|identity_str| {
let config = config.clone();
async move {
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/subcommands/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/codegen/src/unrealcpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion crates/commitlog/src/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/host/instance_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,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);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/host/v8/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions crates/datastore/src/locking_tx_datastore/datastore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,8 @@ impl Locking {
/// error.
pub fn take_snapshot(&self, repo: &DynSnapshotRepo) -> Result<Option<TxOffset>> {
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<()> {
Expand Down Expand Up @@ -3014,7 +3013,7 @@ pub(crate) mod tests {

fn assert_rows(datastore: &Locking, table_id: TableId, rows: Vec<ProductValue>) -> 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(())
Expand Down
11 changes: 4 additions & 7 deletions crates/engine/src/relational_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions crates/engine/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand All @@ -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(())
}

Expand Down
2 changes: 1 addition & 1 deletion crates/lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,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};
Expand Down
1 change: 1 addition & 0 deletions crates/pg/src/pg_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, &params.database).await?;
#[expect(clippy::result_large_err)]
let database = response(
self.ctx
.get_database_by_identity(&database_identity)
Expand Down
1 change: 1 addition & 0 deletions crates/schema/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,7 @@ impl TableDef {

impl From<TableDef> for RawTableDefV9 {
fn from(val: TableDef) -> Self {
#[expect(clippy::unneeded_wildcard_pattern)]
let TableDef {
name,
product_type_ref,
Expand Down
2 changes: 1 addition & 1 deletion crates/schema/src/def/validate/v10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ fn validate_submodules(submodules: Vec<RawSubmoduleV10>) -> Result<IndexMap<Iden
}
map.insert(namespace, def);
}
Err(e) => errors.extend(e.into_iter()),
Err(e) => errors.extend(e),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/smoketests/modules/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions crates/sqltest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,11 @@ async fn update_test_file<T: std::io::Write, D: AsyncDB, M: MakeConnection<Conn
continue;
}
match &record {
Record::Statement { sql, .. } => {
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;
}
_ => (),
}
Expand Down
3 changes: 2 additions & 1 deletion crates/standalone/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ARG CARGO_PROFILE=release


FROM rust:1.93.0 AS chef
# !rust-toolchain-sync
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
Expand Down
7 changes: 3 additions & 4 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[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
channel = "1.93.0"
# run ./tools/rust-toolchain-sync.sh when you change the channel!
# also consider changing the rust-version in Cargo.toml
channel = "1.98.1"
profile = "default"
targets = ["wasm32-unknown-unknown"]
components = ["rust-src"]
2 changes: 1 addition & 1 deletion sdks/rust/src/db_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion sdks/rust/src/spacetime_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/commands/update-flow/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;

Expand Down
4 changes: 2 additions & 2 deletions tools/release/src/crates_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ pub fn get_crate_deps(crate_name: &String, manifest_map: &HashMap<String, PathBu
// Look up the crate in the manifest map
let cargo_toml_path = manifest_map
.get(crate_name)
.with_context(|| format!("Crate '{}' not found in cargo metadata", &crate_name))?;
.with_context(|| format!("Crate '{}' not found in cargo metadata", crate_name))?;

println!("\nChecking crate '{}'...", &crate_name);
println!("\nChecking crate '{}'...", crate_name);

let deps = find_spacetimedb_dependencies(cargo_toml_path)?;
if !deps.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion tools/release/src/targets/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl ReleaseTarget for DockerRelease {

println!("=== Releasing Docker Container ===");
println!("Version: {}", self.version);
println!("Target: {}", &docker_repo_url);
println!("Target: {}", docker_repo_url);

let _local_registry_guard = if self.dry_run {
let container_name = format!("spacetimedb-release-local-registry-{}", std::process::id());
Expand Down
20 changes: 20 additions & 0 deletions tools/rust-toolchain-sync.sh
Original file line number Diff line number Diff line change
@@ -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 }
"
2 changes: 1 addition & 1 deletion tools/xtask-llm-benchmark/src/bin/llm_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ fn model_filter_from_groups(groups: Option<Vec<ModelGroup>>) -> Option<HashMap<V
let mut out: HashMap<Vendor, HashSet<String>> = 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)
}
Expand Down
2 changes: 1 addition & 1 deletion tools/xtask-llm-benchmark/src/context/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn build_context_from_rustdoc_json() -> Result<String> {
});
}

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!(
Expand Down
Loading