rust/tests/ui/pattern/issue-12582.rs

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

22 lines
343 B
Rust
Raw Normal View History

// run-pass
pub fn main() {
2015-01-25 15:05:03 -06:00
let x = 1;
let y = 2;
2015-01-25 15:05:03 -06:00
assert_eq!(3, match (x, y) {
(1, 1) => 1,
(2, 2) => 2,
(1..=2, 2) => 3,
_ => 4,
});
// nested tuple
2015-01-25 15:05:03 -06:00
assert_eq!(3, match ((x, y),) {
((1, 1),) => 1,
((2, 2),) => 2,
((1..=2, 2),) => 3,
_ => 4,
});
}