mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
25 lines
474 B
Rust
25 lines
474 B
Rust
// 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 {
|
|
CONST_SET => { /* ok */ } //~WARN: must implement `PartialEq`
|
|
//~| previously accepted
|
|
_ => panic!("match fell through?"),
|
|
}
|
|
}
|