2019-05-09 21:08:55 +00:00
|
|
|
//@ run-pass
|
2021-07-31 16:14:30 +00:00
|
|
|
|
|
|
|
#![allow(enum_intrinsics_non_enums)]
|
|
|
|
|
2016-06-29 16:15:59 +00:00
|
|
|
use std::mem;
|
|
|
|
|
2023-12-27 22:11:58 +00:00
|
|
|
#[allow(dead_code)]
|
2016-06-29 16:15:59 +00:00
|
|
|
enum ADT {
|
|
|
|
First(u32, u32),
|
|
|
|
Second(u64)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
assert!(mem::discriminant(&ADT::First(0,0)) == mem::discriminant(&ADT::First(1,1)));
|
|
|
|
assert!(mem::discriminant(&ADT::Second(5)) == mem::discriminant(&ADT::Second(6)));
|
|
|
|
assert!(mem::discriminant(&ADT::First(2,2)) != mem::discriminant(&ADT::Second(2)));
|
|
|
|
|
|
|
|
let _ = mem::discriminant(&10);
|
|
|
|
let _ = mem::discriminant(&"test");
|
|
|
|
}
|