2020-06-01 17:23:47 -05:00
|
|
|
// run-pass
|
|
|
|
trait EnumSetType {
|
|
|
|
type Repr;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Enum8 { }
|
|
|
|
impl EnumSetType for Enum8 {
|
|
|
|
type Repr = u8;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(PartialEq, Eq)]
|
|
|
|
struct EnumSet<T: EnumSetType> {
|
|
|
|
__enumset_underlying: T::Repr,
|
|
|
|
}
|
|
|
|
|
|
|
|
const CONST_SET: EnumSet<Enum8> = EnumSet { __enumset_underlying: 3 };
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
match CONST_SET {
|
2023-09-16 07:15:48 -05:00
|
|
|
CONST_SET => { /* ok */ } //~WARN: must implement `PartialEq`
|
|
|
|
//~| previously accepted
|
2020-06-01 17:23:47 -05:00
|
|
|
_ => panic!("match fell through?"),
|
|
|
|
}
|
|
|
|
}
|