Open
Description
Hi, currently this code cannot compile:
#[derive(Clone, Copy, Debug, Decode, Encode, PartialEq)]
#[repr(u16)]
pub enum Status {
Foo = 100,
Bar = 200,
Baz = 300,
}
Error message:
error: literal out of range for `u8`
--> frame/foo/src/lib.rs
|
| Baz = 300,
| ^^^
|
= note: the literal `300` does not fit into the type `u8` whose range is `0..=255`
It's because, as per the documentation,
The variable is encoded with one byte for the variant
but is there a reason to make this rule stands for the C-like enum?
Metadata
Metadata
Assignees
Labels
No labels