Skip to content
TE217 · Type · error

Typed derive attribute does not match its option schema

A namespaced derive attribute contains an unknown, duplicate, missing, non-literal, or incorrectly typed option.

Why this fires

A namespaced derive attribute does not match the option schema declared by its @derive_for: the option may be unknown, duplicated, missing, non-literal, or have the wrong type. Typed attributes accept named arguments only.

struct DbFieldOpts { primary: bool = false }
@derive_for(DbTable, namespace: db, field_attrs: DbFieldOpts)
fn derive_db_table(info) -> Syntax<.Items> {
  return quote items { impl ${info.ref} {} }
}

struct Account {
  @db(primary: "yes") // TE217: expected bool
  id: int,
}

Fix it

Use completion inside @db(...) to select a schema field, then pass a compile-time literal of the declared type.

See also

Search Zolo

9 results

en