mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
33 lines
450 B
Rust
33 lines
450 B
Rust
//@ check-pass
|
|
|
|
#![feature(never_type, exhaustive_patterns)]
|
|
|
|
trait Tag {
|
|
type TagType;
|
|
}
|
|
|
|
enum Keep {}
|
|
enum Erase {}
|
|
|
|
impl Tag for Keep {
|
|
type TagType = ();
|
|
}
|
|
|
|
impl Tag for Erase {
|
|
type TagType = !;
|
|
}
|
|
|
|
enum TagInt<T: Tag> {
|
|
Untagged(i32),
|
|
Tagged(T::TagType, i32)
|
|
}
|
|
|
|
fn test(keep: TagInt<Keep>, erase: TagInt<Erase>) {
|
|
match erase {
|
|
TagInt::Untagged(_) => (),
|
|
TagInt::Tagged(_, _) => ()
|
|
};
|
|
}
|
|
|
|
fn main() {}
|