paritytech / parity-scale-codec

Lightweight, efficient, binary serialization and deserialization codec
Apache License 2.0
256 stars 94 forks source link

Disallow duplicated enum variant indices #507

Open nazar-pc opened 1 year ago

nazar-pc commented 1 year ago

Currently it is possible to do this:

#[derive(Encode, Decode)]
enum E {
    #[codec(index = 0)]
    A,
    #[codec(index = 0)]
    B,
}

Logically it seems like an error and should not compile at all. Admittedly this is a minor issue.

gui1117 commented 1 month ago

related https://github.com/paritytech/parity-scale-codec/issues/173