Hi,

I've just committed a change that requires alt expressions in Rust to
be exhaustive. The change only applies to alts on expressions of type
enum, where the patterns are either irrefutable patterns or
constructor patterns. So for example:

enum foo { a, b }

...
let x:foo = ...; alt x { a { ...} }

will no longer compile.

If you write a non-exhaustive alt (on an enum-typed expression) that
the compiler accepts, that's a bug, so please report it.

Some languages (e.g. Haskell) make this a warning rather than an
error, but after discussion, the Rust team has decided to make it an
error.

Cheers,
Tim

-- 
Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt
“I cannot hide my anger to spare you guilt, nor hurt feelings, nor
answering anger; for to do so insults and trivializes all our efforts.
Guilt is not a response to anger; it is a response to one’s own
actions or lack of action.” -- Audre Lorde
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to