Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to Rust 1.84 #2001

Merged
merged 5 commits into from
Jan 28, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20 # on a successful run, runs in 8 minutes
container:
image: rust:1.78
image: rust:1.83.0
options: --privileged
# filter for a comment containing 'benchmarks please'
if: ${{ github.event_name != 'issue_comment' || (github.event.issue.pull_request && contains(github.event.comment.body, 'benchmarks please')) }}
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ members = [
"tools/upgrade-version",
]
default-members = ["crates/cli"]
# cargo feature graph resolver. v2 is default in edition2021 but workspace
# cargo feature graph resolver. v3 is default in edition2024 but workspace
# manifests don't have editions.
resolver = "2"
resolver = "3"

[profile.release]
opt-level = 3
Expand Down Expand Up @@ -88,7 +88,7 @@ debug = true
version = "1.0.0-rc4"
edition = "2021"
# update rust-toolchain.toml too!
rust-version = "1.78.0"
rust-version = "1.84.0"

[workspace.dependencies]
spacetimedb = { path = "crates/bindings", version = "1.0.0-rc4" }
Expand Down Expand Up @@ -194,7 +194,7 @@ pretty_assertions = { version = "1.4", features = ["unstable"] }
proc-macro2 = "1.0"
prometheus = "0.13.0"
proptest = "1.4"
proptest-derive = "0.4"
proptest-derive = "0.5"
quick-junit = { version = "0.3.2" }
quote = "1.0.8"
rand = "0.8.5"
Expand Down
2 changes: 1 addition & 1 deletion crates/bench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See the README for commands to run.

# sync with: ../../rust-toolchain.toml
FROM rust:1.77.0
FROM rust:1.84.0

RUN apt-get update && \
apt-get install -y valgrind bash && \
Expand Down
2 changes: 1 addition & 1 deletion crates/bindings-macro/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl IndexArg {
Ok(IndexArg { kind, name })
}

fn validate<'a>(&'a self, table_name: &str, cols: &'a [Column<'a>]) -> syn::Result<ValidatedIndex<'_>> {
fn validate<'a>(&'a self, table_name: &str, cols: &'a [Column<'a>]) -> syn::Result<ValidatedIndex<'a>> {
let find_column = |ident| find_column(cols, ident);
let kind = match &self.kind {
IndexType::BTree { columns } => {
Expand Down
2 changes: 2 additions & 0 deletions crates/bindings-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ pub mod raw {
/// - `prefix = prefix_ptr[..prefix_len]`,
/// - `rstart = rstart_ptr[..rstart_len]`,
/// - `rend = rend_ptr[..rend_len]`,
///
/// in WASM memory.
///
/// The index itself has a schema/type.
Expand Down Expand Up @@ -182,6 +183,7 @@ pub mod raw {
/// - `prefix = prefix_ptr[..prefix_len]`,
/// - `rstart = rstart_ptr[..rstart_len]`,
/// - `rend = rend_ptr[..rend_len]`,
///
/// in WASM memory.
///
/// This syscall will delete all the rows found by
Expand Down
2 changes: 1 addition & 1 deletion crates/bindings/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern "C" fn __preinit__00_panic_hook() {
}

/// Our own panic hook logging to the console.
fn panic_hook(info: &panic::PanicInfo) {
fn panic_hook(info: &panic::PanicHookInfo) {
// Try to look into some string types we know (`&'static str` and `String`).
let msg = match info.payload().downcast_ref::<&'static str>() {
Some(s) => *s,
Expand Down
2 changes: 1 addition & 1 deletion crates/bindings/src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl<E: fmt::Display> IntoReducerResult for Result<(), E> {

#[diagnostic::on_unimplemented(
message = "the first argument of a reducer must be `&ReducerContext`",
note = "all reducers must take `&ReducerContext` as their first argument"
label = "first argument must be `&ReducerContext`"
)]
pub trait ReducerContextArg {
// a little hack used in the macro to make error messages nicer. it generates <T as ReducerContextArg>::_ITEM
Expand Down
26 changes: 16 additions & 10 deletions crates/bindings/tests/ui/reducers.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,19 @@ error[E0277]: the reducer argument `Test` does not implement `SpacetimeType`
--> tests/ui/reducers.rs:6:40
|
6 | fn bad_type(_ctx: &ReducerContext, _a: Test) {}
| ^^^^ the trait `SpacetimeType` is not implemented for `Test`, which is required by `Test: ReducerArg`
| ^^^^ the trait `SpacetimeType` is not implemented for `Test`
|
= note: if you own the type, try adding `#[derive(SpacetimeType)]` to its definition
= help: the following other types implement trait `SpacetimeType`:
&T
()
Address
AddressForUrl
AlgebraicTypeRef
Arc<T>
ArrayType
Box<T>
and $N others
= note: required for `Test` to implement `ReducerArg`

error[E0277]: invalid reducer signature
Expand Down Expand Up @@ -119,8 +129,8 @@ error[E0277]: `Test` is not a valid reducer return type
|
= note: reducers cannot return values -- you can only return `()` or `Result<(), impl Display>`
= help: the following other types implement trait `IntoReducerResult`:
Result<(), E>
()
Result<(), E>

error[E0277]: invalid reducer signature
--> tests/ui/reducers.rs:9:4
Expand Down Expand Up @@ -168,9 +178,9 @@ error[E0277]: the first argument of a reducer must be `&ReducerContext`
--> tests/ui/reducers.rs:23:20
|
23 | fn missing_ctx(_a: u8) {}
| ^^ the trait `ReducerContextArg` is not implemented for `u8`
| ^^ first argument must be `&ReducerContext`
|
= note: all reducers must take `&ReducerContext` as their first argument
= help: the trait `ReducerContextArg` is not implemented for `u8`
= help: the trait `ReducerContextArg` is implemented for `&ReducerContext`

error[E0277]: invalid reducer signature
Expand Down Expand Up @@ -219,13 +229,9 @@ error[E0277]: the first argument of a reducer must be `&ReducerContext`
--> tests/ui/reducers.rs:26:21
|
26 | fn ctx_by_val(_ctx: ReducerContext, _a: u8) {}
| ^^^^^^^^^^^^^^
| |
| the trait `ReducerContextArg` is not implemented for `ReducerContext`
| the trait `ReducerContextArg` is not implemented for `ReducerContext`
| ^^^^^^^^^^^^^^ first argument must be `&ReducerContext`
|
= note: the trait bound `ReducerContext: ReducerContextArg` is not satisfied
= note: all reducers must take `&ReducerContext` as their first argument
= help: the trait `ReducerContextArg` is not implemented for `ReducerContext`
= help: the trait `ReducerContextArg` is implemented for `&ReducerContext`

error[E0277]: invalid reducer signature
Expand Down
76 changes: 43 additions & 33 deletions crates/bindings/tests/ui/tables.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ error[E0277]: the column type `Test` does not implement `SpacetimeType`
--> tests/ui/tables.rs:5:8
|
5 | x: Test,
| ^^^^ the trait `SpacetimeType` is not implemented for `Test`, which is required by `Test: TableColumn`
| ^^^^ the trait `SpacetimeType` is not implemented for `Test`
|
= note: table column types all must implement `SpacetimeType`
= note: if you own the type, try adding `#[derive(SpacetimeType)]` to its definition
= help: the following other types implement trait `SpacetimeType`:
&T
()
Address
AddressForUrl
AlgebraicTypeRef
Arc<T>
ArrayType
Box<T>
and $N others
= note: required for `Test` to implement `TableColumn`

error[E0277]: the trait bound `Test: SpacetimeType` is not satisfied
Expand All @@ -28,14 +38,14 @@ error[E0277]: the trait bound `Test: SpacetimeType` is not satisfied
|
= note: if you own the type, try adding `#[derive(SpacetimeType)]` to its definition
= help: the following other types implement trait `SpacetimeType`:
bool
i8
i16
i32
i64
i128
u8
u16
&T
()
Address
AddressForUrl
AlgebraicTypeRef
Arc<T>
ArrayType
Box<T>
and $N others

error[E0277]: the trait bound `Test: Deserialize<'de>` is not satisfied
Expand All @@ -48,14 +58,14 @@ error[E0277]: the trait bound `Test: Deserialize<'de>` is not satisfied
| ^^^^ the trait `Deserialize<'de>` is not implemented for `Test`
|
= help: the following other types implement trait `Deserialize<'de>`:
bool
i8
i16
i32
i64
i128
u8
u16
&'de [u8]
&'de str
()
Address
AddressForUrl
AlgebraicTypeRef
Arc<[T]>
ArrayType
and $N others
note: required by a bound in `spacetimedb::spacetimedb_lib::de::SeqProductAccess::next_element`
--> $WORKSPACE/crates/sats/src/de.rs
Expand All @@ -70,14 +80,14 @@ error[E0277]: the trait bound `Test: Deserialize<'_>` is not satisfied
| ^^^^ the trait `Deserialize<'_>` is not implemented for `Test`
|
= help: the following other types implement trait `Deserialize<'de>`:
bool
i8
i16
i32
i64
i128
u8
u16
&'de [u8]
&'de str
()
Address
AddressForUrl
AlgebraicTypeRef
Arc<[T]>
ArrayType
and $N others
note: required by a bound in `get_field_value`
--> $WORKSPACE/crates/sats/src/de.rs
Expand All @@ -92,14 +102,14 @@ error[E0277]: the trait bound `Test: Serialize` is not satisfied
| ^^^^ the trait `Serialize` is not implemented for `Test`
|
= help: the following other types implement trait `Serialize`:
bool
i8
i16
i32
i64
i128
u8
u16
&T
()
Address
AddressForUrl
AlgebraicTypeRef
Arc<T>
ArrayType
ArrayValue
and $N others
note: required by a bound in `spacetimedb::spacetimedb_lib::ser::SerializeNamedProduct::serialize_element`
--> $WORKSPACE/crates/sats/src/ser.rs
Expand Down
18 changes: 9 additions & 9 deletions crates/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn read_table<'a>(table: &'a toml_edit::Table, key: &'a str) -> Result<Option<&'
Err(CliError::ConfigType {
key: key.to_string(),
kind: "table array",
found: value.clone(),
found: Box::new(value.clone()),
})
}
} else {
Expand All @@ -86,7 +86,7 @@ fn read_opt_str(table: &toml_edit::Table, key: &str) -> Result<Option<String>, C
Err(CliError::ConfigType {
key: key.to_string(),
kind: "string",
found: value.clone(),
found: Box::new(value.clone()),
})
}
} else {
Expand Down Expand Up @@ -1000,23 +1000,23 @@ default_server = "local"
CliError::ConfigType {
key: "default_server".to_string(),
kind: "string",
found: toml_edit::value(1),
found: Box::new(toml_edit::value(1)),
},
)?;
check_invalid(
r#"web_session_token =1"#,
CliError::ConfigType {
key: "web_session_token".to_string(),
kind: "string",
found: toml_edit::value(1),
found: Box::new(toml_edit::value(1)),
},
)?;
check_invalid(
r#"spacetimedb_token =1"#,
CliError::ConfigType {
key: "spacetimedb_token".to_string(),
kind: "string",
found: toml_edit::value(1),
found: Box::new(toml_edit::value(1)),
},
)?;
check_invalid(
Expand All @@ -1026,7 +1026,7 @@ default_server = "local"
CliError::ConfigType {
key: "server_configs".to_string(),
kind: "table array",
found: toml_edit::table(),
found: Box::new(toml_edit::table()),
},
)?;
check_invalid(
Expand All @@ -1037,7 +1037,7 @@ nickname =1
CliError::ConfigType {
key: "nickname".to_string(),
kind: "string",
found: toml_edit::value(1),
found: Box::new(toml_edit::value(1)),
},
)?;
check_invalid(
Expand All @@ -1048,7 +1048,7 @@ host =1
CliError::ConfigType {
key: "host".to_string(),
kind: "string",
found: toml_edit::value(1),
found: Box::new(toml_edit::value(1)),
},
)?;

Expand All @@ -1061,7 +1061,7 @@ protocol =1
CliError::ConfigType {
key: "protocol".to_string(),
kind: "string",
found: toml_edit::value(1),
found: Box::new(toml_edit::value(1)),
},
)?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum CliError {
ConfigType {
key: String,
kind: &'static str,
found: toml_edit::Item,
found: Box<toml_edit::Item>,
},
}

Expand Down
4 changes: 2 additions & 2 deletions crates/cli/src/subcommands/generate/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ pub fn type_name(module: &ModuleDef, ty: &AlgebraicTypeUse) -> String {
s
}

const ALLOW_UNUSED: &str = "#![allow(unused)]";
const ALLOW_LINTS: &str = "#![allow(unused, clippy::all)]";

const SPACETIMEDB_IMPORTS: &[&str] = &[
"use spacetimedb_sdk::__codegen::{",
Expand All @@ -639,7 +639,7 @@ fn print_spacetimedb_imports(output: &mut Indenter) {

fn print_file_header(output: &mut Indenter) {
print_auto_generated_file_comment(output);
write!(output, "{ALLOW_UNUSED}");
writeln!(output, "{ALLOW_LINTS}");
print_spacetimedb_imports(output);
}

Expand Down
Loading