E4214

E4214#

Compiler diagnostic name: cannot_extend_non_extensible_enum.

Only extenum declarations can be extended.

Regular enum declarations are closed: all of their constructors must appear in the original declaration. To add constructors later, declare the type as extenum from the start.

Erroneous example#

pub enum Event {
  Started
}

pub extenum Event += {
  Stopped
}

The code tries to extend a regular enum.

Suggestion#

Declare the type as extenum before extending it.

pub extenum Event {
  Started
}

pub extenum Event += {
  Stopped
}

pub fn all() -> (Event, Event) {
  (Started, Stopped)
}