On 24/03/14 12:32 -0400, Josh Matthews wrote:
Nope; we can't use casts of enum values in type signatures. This is
discussed in https://github.com/mozilla/rust/issues/5873 .
Cheers,
Josh
I continued messing with this last night. Yurume on IRC rightfully pointed
out that having the MAX as a variant of the enum is basically broken by
design, you have a variant that is semantically meaningless, so you either
have to explicitly match ... { MAX => unreachable! } everywhere, or have non
exhaustive patterns.
While I still feel that being able to use scalar enum variants in this
context would *sometimes* be useful, I'm less convinced that this pattern is
a good idea.
That said, how would you feel about a patch such that:
enum FooBar {
foo,
bar,
baz
}
let vec: [u8, .. FooBar::size()];
Potentially with parens ommittted, to convey that there's no runtime
computation?
Cheers
richo
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev