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¶
TE100— undefined variable (the equivalent check for values, not types).- /docs/data-structures#enums — enum variants and payloads.