trait EnumSetType { type Repr; } enum Enum8 { } impl EnumSetType for Enum8 { type Repr = u8; } #[derive(PartialEq, Eq)] struct EnumSet { __enumset_underlying: T::Repr, } const CONST_SET: EnumSet = EnumSet { __enumset_underlying: 3 }; fn main() { match CONST_SET { CONST_SET => { /* ok */ } //~ERROR: must implement `PartialEq` _ => panic!("match fell through?"), } }