Skip to content
ZOLO / TM112 Type · error

self-using mixin applied to a free function

Compiler diagnostic TM112: self-using mixin applied to a free function.

Why this fires

A mixin that references self is a method mixin. Applying it to a free function would leave self without a receiver.

@mixin
fn named() -> str { self.name }

@named
fn value() -> str { "value" }
// ^ error[TM112]

Fix it

Apply the mixin to an impl method, or remove the receiver dependency and write the mixin only in terms of super(...) and its configuration values.

See also

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en