Skip to content

Rust modules: negative default values cause build error #5622

Description

@bfops

example module:

use spacetimedb::Table;

#[spacetimedb::table(accessor = foo, public)]
pub struct Foo {
    #[default(-8)]
    count: i16,
}
    stderr:    Compiling smoketest_module_fhwyysycwblss v0.1.0 (/tmp/.tmpAUgfgl)
    error[E0600]: cannot apply unary operator `-` to type `AlgebraicValue`
      --> src/lib.rs:2:1
       |
     2 | #[spacetimedb::table(accessor = defaults_test_table, public)]
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot apply unary operator `-`
       |
    note: `AlgebraicValue` does not implement `Neg`
      --> /home/work/SpacetimeDBPrivate/public/crates/sats/src/algebraic_value.rs:28:1
       |
    28 | pub enum AlgebraicValue {
       | ^^^^^^^^^^^^^^^^^^^^^^^ `AlgebraicValue` is defined in another crate
       = note: this error originates in the attribute macro `spacetimedb::table` (in Nightly builds, run with -Z macro-backtrace for more info)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions