rust/tests/ui/enum-discriminant/discriminant_value-wrapper.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
498 B
Rust
Raw Normal View History

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;
#[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");
}