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.96.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 @@ -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.96.0"

[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.96.1

RUN apt-get update && \
apt-get install -y valgrind bash && \
Expand Down
12 changes: 6 additions & 6 deletions crates/bindings/tests/ui/environment_enum.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ error: expected string literal
38 | #[env(value = 1)]
| ^

error[E0277]: the trait bound `Option<Mode>: RequiredEnvironmentValue` is not satisfied
error[E0277]: the trait bound `Option<Mode>: spacetimedb::rt::RequiredEnvironmentValue` is not satisfied
--> tests/ui/environment_enum.rs:51:17
|
51 | pub NESTED: Option<Option<Mode>>,
| ^^^^^^^^^^^^^^^^^^^^ the trait `RequiredEnvironmentValue` is not implemented for `Option<Mode>`
| ^^^^^^^^^^^^^^^^^^^^ the trait `spacetimedb::rt::RequiredEnvironmentValue` is not implemented for `Option<Mode>`
|
help: the following other types implement trait `RequiredEnvironmentValue`
help: the following other types implement trait `spacetimedb::rt::RequiredEnvironmentValue`
--> tests/ui/environment_enum.rs:42:10
|
42 | #[derive(spacetimedb::EnvironmentValue)]
Expand All @@ -62,7 +62,7 @@ help: the following other types implement trait `RequiredEnvironmentValue`
|
| impl RequiredEnvironmentValue for String {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::string::String`
= note: required for `Option<Option<Mode>>` to implement `EnvironmentValue`
= note: required for `Option<Option<Mode>>` to implement `spacetimedb::rt::EnvironmentValue`
= note: this error originates in the derive macro `spacetimedb::EnvironmentValue` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `#[env(values(...))]` requires `String` or `Option<String>`; map enum variants with `#[env(value = "...")]` instead
Expand All @@ -71,12 +71,12 @@ error[E0277]: `#[env(values(...))]` requires `String` or `Option<String>`; map e
50 | pub MODE: Mode,
| ^^^^ unsatisfied trait bound
|
help: the trait `StringEnvironmentValue` is not implemented for `Mode`
help: the trait `spacetimedb::rt::StringEnvironmentValue` is not implemented for `Mode`
--> tests/ui/environment_enum.rs:43:1
|
43 | pub enum Mode {
| ^^^^^^^^^^^^^
help: the following other types implement trait `StringEnvironmentValue`
help: the following other types implement trait `spacetimedb::rt::StringEnvironmentValue`
--> src/rt.rs
|
| impl StringEnvironmentValue for String {}
Expand Down
24 changes: 12 additions & 12 deletions crates/bindings/tests/ui/environment_types.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ error[E0277]: environment fields must be `String`, an enum deriving `Environment
6 | pub VALUE: String,
| ^^^^^^ unsatisfied trait bound
|
help: the trait `EnvironmentValue` is not implemented for `shadowed_string::String`
help: the trait `spacetimedb::rt::EnvironmentValue` is not implemented for `shadowed_string::String`
--> tests/ui/environment_types.rs:2:5
|
2 | pub struct String;
| ^^^^^^^^^^^^^^^^^
help: the following other types implement trait `EnvironmentValue`
help: the following other types implement trait `spacetimedb::rt::EnvironmentValue`
--> src/rt.rs
|
| impl EnvironmentValue for String {
Expand All @@ -24,12 +24,12 @@ error[E0277]: environment fields must be `String`, an enum deriving `Environment
15 | pub VALUE: Option<String>,
| ^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `EnvironmentValue` is not implemented for `shadowed_option::Option<std::string::String>`
help: the trait `spacetimedb::rt::EnvironmentValue` is not implemented for `shadowed_option::Option<std::string::String>`
--> tests/ui/environment_types.rs:11:5
|
11 | pub struct Option<T>(T);
| ^^^^^^^^^^^^^^^^^^^^
help: the following other types implement trait `EnvironmentValue`
help: the following other types implement trait `spacetimedb::rt::EnvironmentValue`
--> src/rt.rs
|
| impl EnvironmentValue for String {
Expand All @@ -42,9 +42,9 @@ error[E0277]: environment fields must be `String`, an enum deriving `Environment
--> tests/ui/environment_types.rs:21:15
|
21 | pub BOOL: bool,
| ^^^^ the trait `EnvironmentValue` is not implemented for `bool`
| ^^^^ the trait `spacetimedb::rt::EnvironmentValue` is not implemented for `bool`
|
help: the following other types implement trait `EnvironmentValue`
help: the following other types implement trait `spacetimedb::rt::EnvironmentValue`
--> src/rt.rs
|
| impl EnvironmentValue for String {
Expand All @@ -53,26 +53,26 @@ help: the following other types implement trait `EnvironmentValue`
| impl<T: RequiredEnvironmentValue> EnvironmentValue for Option<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::option::Option<T>`

error[E0277]: the trait bound `std::option::Option<std::string::String>: RequiredEnvironmentValue` is not satisfied
error[E0277]: the trait bound `std::option::Option<std::string::String>: spacetimedb::rt::RequiredEnvironmentValue` is not satisfied
--> tests/ui/environment_types.rs:22:17
|
22 | pub NESTED: Option<Option<String>>,
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `RequiredEnvironmentValue` is not implemented for `std::option::Option<std::string::String>`
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `spacetimedb::rt::RequiredEnvironmentValue` is not implemented for `std::option::Option<std::string::String>`
|
help: the trait `RequiredEnvironmentValue` is implemented for `std::string::String`
help: the trait `spacetimedb::rt::RequiredEnvironmentValue` is implemented for `std::string::String`
--> src/rt.rs
|
| impl RequiredEnvironmentValue for String {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: required for `std::option::Option<std::option::Option<std::string::String>>` to implement `EnvironmentValue`
= note: required for `std::option::Option<std::option::Option<std::string::String>>` to implement `spacetimedb::rt::EnvironmentValue`

error[E0277]: environment fields must be `String`, an enum deriving `EnvironmentValue`, or an `Option` of either
--> tests/ui/environment_types.rs:24:14
|
24 | pub get: u32,
| ^^^ the trait `EnvironmentValue` is not implemented for `u32`
| ^^^ the trait `spacetimedb::rt::EnvironmentValue` is not implemented for `u32`
|
help: the following other types implement trait `EnvironmentValue`
help: the following other types implement trait `spacetimedb::rt::EnvironmentValue`
--> src/rt.rs
|
| impl EnvironmentValue for String {
Expand Down
235 changes: 39 additions & 196 deletions crates/bindings/tests/ui/http_handlers.stderr
Original file line number Diff line number Diff line change
@@ -1,205 +1,48 @@
error: HTTP handlers must take exactly two arguments
--> tests/ui/http_handlers.rs:5:1
|
5 | fn handler_no_args() -> Response {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: HTTP handlers must take exactly two arguments
--> tests/ui/http_handlers.rs:20:1
|
20 | fn handler_no_request_arg(_ctx: &mut HandlerContext) -> Response {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: HTTP handlers must return `spacetimedb::http::Response`
--> tests/ui/http_handlers.rs:30:1
|
30 | fn handler_no_return_type(_ctx: &mut HandlerContext, _req: Request) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: expected `fn`
--> tests/ui/http_handlers.rs:58:1
|
58 | static ROUTER_NOT_A_FUNCTION: Router = Router::new();
| ^^^^^^

error: HTTP router functions must take no arguments
--> tests/ui/http_handlers.rs:61:1
|
61 | fn router_fn_with_args(ctx: &mut HandlerContext) -> Router {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `Router`
--> tests/ui/http_handlers.rs:1:77
error[E0432]: unresolved imports `spacetimedb::http::handler`, `spacetimedb::http::router`, `spacetimedb::http::HandlerContext`, `spacetimedb::http::Router`
--> tests/ui/http_handlers.rs:1:25
|
1 | use spacetimedb::http::{handler, router, HandlerContext, Request, Response, Router};
| ^^^^^^
| ^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^ no `Router` in `http`
| | | |
| | | no `HandlerContext` in `http`
| | no `router` in `http`
| no `handler` in `http`
|
note: found an item that was configured out
--> src/http.rs
|
| #[cfg(feature = "unstable")]
| -------------------- the item is gated behind the `unstable` feature
| #[doc(inline)]
| pub use spacetimedb_bindings_macro::http_handler as handler;
| ^^^^^^^
note: found an item that was configured out
--> src/http.rs
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
| #[cfg(feature = "unstable")]
| -------------------- the item is gated behind the `unstable` feature
| #[doc(inline)]
| pub use spacetimedb_bindings_macro::http_router as router;
| ^^^^^^
note: found an item that was configured out
--> src/http.rs
|
| #[cfg(feature = "unstable")]
| -------------------- the item is gated behind the `unstable` feature
| #[non_exhaustive]
| pub struct HandlerContext {
| ^^^^^^^^^^^^^^
note: found an item that was configured out
--> src/http.rs
|
| #[cfg(feature = "unstable")]
| -------------------- the item is gated behind the `unstable` feature
| #[derive(Clone, Default)]
| pub struct Router {
| ^^^^^^

error[E0601]: `main` function not found in crate `$CRATE`
--> tests/ui/http_handlers.rs:68:2
|
68 | }
| ^ consider adding a `main` function to `$DIR/tests/ui/http_handlers.rs`

error[E0308]: mismatched types
--> tests/ui/http_handlers.rs:10:4
|
9 | #[handler]
| ---------- arguments to this function are incorrect
10 | fn handler_immutable_ctx(_ctx: &HandlerContext, _req: Request) -> Response {
| ^^^^^^^^^^^^^^^^^^^^^ types differ in mutability
|
= note: expected fn pointer `for<'a> fn(&'a mut HandlerContext, http::request::Request<Body>) -> http::response::Response<Body>`
found fn item `for<'a> fn(&'a HandlerContext, http::request::Request<Body>) -> http::response::Response<Body> {__spacetimedb_http_handler_handler_immutable_ctx}`
note: function defined here
--> src/rt.rs
|
| pub fn register_http_handler(name: &'static str, handler: HttpHandlerFn) {
| ^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the first argument of an HTTP handler must be `&mut HandlerContext`
--> tests/ui/http_handlers.rs:10:32
|
10 | fn handler_immutable_ctx(_ctx: &HandlerContext, _req: Request) -> Response {
| ^^^^^^^^^^^^^^^ first argument must be `&mut HandlerContext`
|
= help: the trait `HttpHandlerContextArg` is not implemented for `&HandlerContext`
help: the trait `HttpHandlerContextArg` is implemented for `&mut HandlerContext`
--> src/rt.rs
|
| impl HttpHandlerContextArg for &mut HandlerContext {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: `HttpHandlerContextArg` is implemented for `&mut HandlerContext`, but not for `&HandlerContext`

error[E0308]: mismatched types
--> tests/ui/http_handlers.rs:15:4
|
14 | #[handler]
| ---------- arguments to this function are incorrect
15 | fn handler_wrong_ctx(_ctx: &mut ProcedureContext, _req: Request) -> Response {
| ^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
|
= note: expected fn pointer `for<'a> fn(&'a mut HandlerContext, http::request::Request<Body>) -> http::response::Response<Body>`
found fn item `for<'a> fn(&'a mut ProcedureContext, http::request::Request<Body>) -> http::response::Response<Body> {__spacetimedb_http_handler_handler_wrong_ctx}`
note: function defined here
--> src/rt.rs
|
| pub fn register_http_handler(name: &'static str, handler: HttpHandlerFn) {
| ^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the first argument of an HTTP handler must be `&mut HandlerContext`
--> tests/ui/http_handlers.rs:15:28
|
15 | fn handler_wrong_ctx(_ctx: &mut ProcedureContext, _req: Request) -> Response {
| ^^^^^^^^^^^^^^^^^^^^^ first argument must be `&mut HandlerContext`
|
= help: the trait `HttpHandlerContextArg` is not implemented for `&mut ProcedureContext`
help: the trait `HttpHandlerContextArg` is implemented for `&mut HandlerContext`
--> src/rt.rs
|
| impl HttpHandlerContextArg for &mut HandlerContext {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
--> tests/ui/http_handlers.rs:25:4
|
24 | #[handler]
| ---------- arguments to this function are incorrect
25 | fn handler_wrong_request_arg_type(_ctx: &mut HandlerContext, _req: u32) -> Response {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
|
= note: expected fn pointer `for<'a> fn(&'a mut HandlerContext, http::request::Request<Body>) -> http::response::Response<Body>`
found fn item `for<'a> fn(&'a mut HandlerContext, u32) -> http::response::Response<Body> {__spacetimedb_http_handler_handler_wrong_request_arg_type}`
note: function defined here
--> src/rt.rs
|
| pub fn register_http_handler(name: &'static str, handler: HttpHandlerFn) {
| ^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the second argument of an HTTP handler must be `spacetimedb::http::Request`
--> tests/ui/http_handlers.rs:25:68
|
25 | fn handler_wrong_request_arg_type(_ctx: &mut HandlerContext, _req: u32) -> Response {
| ^^^ the trait `HttpHandlerRequestArg` is not implemented for `u32`
|
help: the trait `HttpHandlerRequestArg` is implemented for `http::request::Request<Body>`
--> src/rt.rs
|
| impl HttpHandlerRequestArg for crate::http::Request {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
--> tests/ui/http_handlers.rs:35:4
|
34 | #[handler]
| ---------- arguments to this function are incorrect
35 | fn handler_wrong_return_type(_ctx: &mut HandlerContext, _req: Request) -> u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
|
= note: expected fn pointer `for<'a> fn(&'a mut HandlerContext, http::request::Request<Body>) -> http::response::Response<Body>`
found fn item `for<'a> fn(&'a mut HandlerContext, http::request::Request<Body>) -> u32 {__spacetimedb_http_handler_handler_wrong_return_type}`
note: function defined here
--> src/rt.rs
|
| pub fn register_http_handler(name: &'static str, handler: HttpHandlerFn) {
| ^^^^^^^^^^^^^^^^^^^^^

error[E0277]: HTTP handlers must return `spacetimedb::http::Response`
--> tests/ui/http_handlers.rs:35:75
|
35 | fn handler_wrong_return_type(_ctx: &mut HandlerContext, _req: Request) -> u32 {
| ^^^ the trait `HttpHandlerReturn` is not implemented for `u32`
|
help: the trait `HttpHandlerReturn` is implemented for `http::response::Response<Body>`
--> src/rt.rs
|
| impl HttpHandlerReturn for crate::http::Response {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0599]: no method named `sender` found for mutable reference `&mut HandlerContext` in the current scope
--> tests/ui/http_handlers.rs:41:23
|
41 | let _sender = ctx.sender();
| ^^^^^^ method not found in `&mut HandlerContext`

error[E0599]: no method named `connection_id` found for mutable reference `&mut HandlerContext` in the current scope
--> tests/ui/http_handlers.rs:42:24
|
42 | let _conn_id = ctx.connection_id();
| ^^^^^^^^^^^^^ method not found in `&mut HandlerContext`

error[E0609]: no field `db` on type `&mut HandlerContext`
--> tests/ui/http_handlers.rs:53:21
|
53 | let _rows = ctx.db.test_table().iter();
| ^^ unknown field
|
= note: available fields are: `env`, `timestamp`, `http`

error[E0308]: mismatched types
--> tests/ui/http_handlers.rs:66:4
|
65 | #[router]
| --------- expected due to this
66 | fn router_fn_wrong_return_type() -> u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
|
= note: expected fn pointer `fn() -> Router`
found fn item `fn() -> u32 {router_fn_wrong_return_type}`

error[E0308]: mismatched types
--> tests/ui/http_handlers.rs:66:4
|
65 | #[router]
| --------- arguments to this function are incorrect
66 | fn router_fn_wrong_return_type() -> u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
|
= note: expected fn pointer `fn() -> Router`
found fn item `fn() -> u32 {router_fn_wrong_return_type}`
note: function defined here
--> src/rt.rs
|
| pub fn register_http_router(build: fn() -> crate::http::Router) {
| ^^^^^^^^^^^^^^^^^^^^
Loading
Loading