]> git.lizzy.rs Git - rust.git/blob - tests/ui/match/issue-42679.rs
Rollup merge of #106470 - ehuss:tidy-no-wasm, r=Mark-Simulacrum
[rust.git] / tests / ui / match / issue-42679.rs
1 // run-pass
2 #![feature(box_patterns)]
3
4 #[derive(Debug, PartialEq)]
5 enum Test {
6     Foo(usize),
7     Bar(isize),
8 }
9
10 fn main() {
11     let a = Box::new(Test::Foo(10));
12     let b = Box::new(Test::Bar(-20));
13     match (a, b) {
14         (_, box Test::Foo(_)) => unreachable!(),
15         (box Test::Foo(x), b) => {
16             assert_eq!(x, 10);
17             assert_eq!(b, Box::new(Test::Bar(-20)));
18         },
19         _ => unreachable!(),
20     }
21 }