Skip to content
ZOLO / TE103 Type · error

undefined type in enum variant

A type annotation or enum-variant field references a type the compiler cannot resolve.

Why this fires

An enum variant's payload names a type that doesn't resolve to anything known — not a builtin scalar (int, str, bool, ...), not another declared type, and not a type parameter in scope.

enum Shape {
    Circle(Radius),
    //     ^^^^^^ error[TE103]: undefined type 'Radius' in variant 'Shape.Circle'.
    //             Did you mean a concrete type (e.g. 'Circle(float)') or a
    //             named field ('Circle { Radius: float }')?
    Square(float),
}

This check is skipped whenever the program has a plugin glob import (use plugin X::*), since those can bring in types the compiler has no metadata for.

Fix it

1. Use a real type

enum Shape {
    Circle(float),          // ok — a concrete builtin type
    Square(float),
}

2. Declare the missing type

If Radius was meant to be a real struct/type alias, declare it first:

struct Radius { value: float }

enum Shape {
    Circle(Radius),         // ok — Radius is now a known struct
    Square(float),
}

See also

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br