2025-07-24 19:07:20 +05:00
|
|
|
//! Regression test for https://github.com/rust-lang/rust/issues/15129
|
|
|
|
|
|
2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2014-06-24 00:12:17 +02:00
|
|
|
pub enum T {
|
|
|
|
|
T1(()),
|
2025-07-24 19:07:20 +05:00
|
|
|
T2(()),
|
2014-06-24 00:12:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub enum V {
|
2015-03-25 17:06:52 -07:00
|
|
|
V1(isize),
|
2025-07-24 19:07:20 +05:00
|
|
|
V2(bool),
|
2014-06-24 00:12:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn foo(x: (T, V)) -> String {
|
|
|
|
|
match x {
|
2025-07-24 19:07:20 +05:00
|
|
|
(T::T1(()), V::V1(i)) => format!("T1(()), V1({})", i),
|
|
|
|
|
(T::T2(()), V::V2(b)) => format!("T2(()), V2({})", b),
|
|
|
|
|
_ => String::new(),
|
2014-06-24 00:12:17 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
2014-11-06 00:05:53 -08:00
|
|
|
assert_eq!(foo((T::T1(()), V::V1(99))), "T1(()), V1(99)".to_string());
|
|
|
|
|
assert_eq!(foo((T::T2(()), V::V2(true))), "T2(()), V2(true)".to_string());
|
2014-06-24 00:12:17 +02:00
|
|
|
}
|