Skip to content
ZOLO / TE186 Type · error

built-in decorator name claimed as a typed attribute namespace

Compiler diagnostic TE186: built-in decorator name claimed as a typed attribute namespace.

Why this fires

A @derive_for claims the name of a built-in decorator as its attribute namespace:. Typed attributes are read back from the decorators on a type and its fields, so @linear(...), @must_use(...) or @rename(...) would mean two things at once: the compiler's own decorator and your deriver's options.

struct Options { label: str? }

@derive_for(Tagged, namespace: linear, type_attrs: Options) // TE186
pub fn Tagged(info) -> str {
  return ""
}

linear and scoped are reserved for linear types (specs/linear-affine-types-innovations.html), together with every decorator the compiler already gives meaning to (derive, must_use, deprecated, flags, stable, serialize, rename, skip, sql_column, test, …).

Fix it

Choose a namespace that names your library or domain instead:

@derive_for(Tagged, namespace: tagged, type_attrs: Options)
pub fn Tagged(info) -> str {
  return ""
}

@derive(Tagged)
@tagged(label: "member")
struct Member { id: int }

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en