* Niko Matsakis:

>> We can remove the c variant from the enum_type definition, and the
>> program still compiles (even though this smells like a bug).  It keeps
>> compiling if we add a d variant to enum_type.  Flagging unused bound
>> variables as error isn't a reliable countermeasure because the
>> variant-now-variable might actually be used.
>
> This is because exhaustiveness checking is not implemented.

The last part also applies with exhaustiveness checking.  You can
reproduce this with Standard ML (which requires such checks and lacks
a lexical destinction between datacons and binders, or whatever the
technical terms are)"

datatype enum_type = a | b | c (* or: d *)

fun repr a = "a"
  | repr b  = "b"
  | repr c = "c"

Besides lexical distinction in one way or other, I'm not aware of a
solution.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to