2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-08-31 13:28:26 +00:00
|
|
|
#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620
|
2018-08-30 12:18:55 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2015-01-25 21:05:03 +00:00
|
|
|
let x = [1, 2, 3];
|
2012-12-15 23:13:55 +00:00
|
|
|
match x {
|
2014-10-09 19:17:22 +00:00
|
|
|
[2, _, _] => panic!(),
|
2014-02-13 17:46:46 +00:00
|
|
|
[1, a, b] => {
|
2015-06-07 18:00:38 +00:00
|
|
|
assert_eq!([a, b], [2, 3]);
|
2012-12-15 23:13:55 +00:00
|
|
|
}
|
2014-10-09 19:17:22 +00:00
|
|
|
[_, _, _] => panic!(),
|
2012-12-15 23:13:55 +00:00
|
|
|
}
|
|
|
|
|
2015-01-25 21:05:03 +00:00
|
|
|
let y = ([(1, true), (2, false)], 0.5f64);
|
2012-12-15 23:13:55 +00:00
|
|
|
match y {
|
2014-02-13 17:46:46 +00:00
|
|
|
([(1, a), (b, false)], _) => {
|
2013-05-19 02:02:45 +00:00
|
|
|
assert_eq!(a, true);
|
|
|
|
assert_eq!(b, 2);
|
2012-12-15 23:13:55 +00:00
|
|
|
}
|
2014-10-09 19:17:22 +00:00
|
|
|
([_, _], 0.5) => panic!(),
|
|
|
|
([_, _], _) => panic!(),
|
2012-12-15 23:13:55 +00:00
|
|
|
}
|
|
|
|
}
|