# E4213

Compiler diagnostic name: `constr_for_non_struct`.

Constructor methods can only be defined for `struct` types.

MoonBit's `Type::Type` constructor mechanism belongs to structs. Enums,
newtypes, and other type forms already have their own construction syntax, so a
constructor method for those types is rejected.

## Erroneous example

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

`Status` is an `enum`, not a `struct`, so `Status::Status` cannot be used as a
struct constructor.

## Suggestion

Use the enum constructor directly, or change the type to a `struct` if you need a
custom constructor method.

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