# E4213

Compiler diagnostic name: `invalid_constr_self_type`.

Custom constructors cannot be defined for trait object types such as `&Trait`.

MoonBit supports custom constructors for user-defined concrete types, including
structs, enums, and newtypes. A trait object is an erased runtime view rather
than a concrete type that can own a constructor, so `fn &Trait::Trait(...)` is
rejected.

## Erroneous example

```{literalinclude} /sources/error_codes/4213_error/top.mbt
:language: moonbit
```

The erroneous example tries to make `&Renderable::Renderable` a constructor for
the trait object type.

## Suggestion

Use a normal function to convert a value to the trait object, or define a custom
constructor on a concrete wrapper type.

```{literalinclude} /sources/error_codes/4213_fixed/top.mbt
:language: moonbit
```
