Skip to content

Commit

Permalink
Update ui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
coolreader18 committed Nov 19, 2024
1 parent 68d3760 commit f2a4169
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 42 deletions.
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
24 changes: 15 additions & 9 deletions crates/bindings/tests/ui/reducers.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ error[E0277]: the reducer argument `Test` does not implement `SpacetimeType`
| ^^^^ the trait `SpacetimeType` is not implemented for `Test`, which is required by `Test: ReducerArg`
|
= 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 @@ -109,8 +119,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 @@ -158,9 +168,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 @@ -209,13 +219,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
74 changes: 42 additions & 32 deletions crates/bindings/tests/ui/tables.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ error[E0277]: the column type `Test` does not implement `SpacetimeType`
|
= 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

0 comments on commit f2a4169

Please sign in to comment.