E4031

E4031#

The constructor is not found.

Erroneous Example#

pub enum U {
  V
}

pub fn make() -> U {
  W
}

The example above tries to assign a variant W to a variable v of type U, but this variant doesn't exist, giving the following error on line 2:

The variant type U does not have the constructor W.

Suggestion#

Make sure to use the correct constructor instead:

pub enum U {
  V
}

pub fn make() -> U {
  V
}