From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/match/issue-42679.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/ui/match/issue-42679.rs (limited to 'tests/ui/match/issue-42679.rs') diff --git a/tests/ui/match/issue-42679.rs b/tests/ui/match/issue-42679.rs new file mode 100644 index 000000000..46a0bd35d --- /dev/null +++ b/tests/ui/match/issue-42679.rs @@ -0,0 +1,21 @@ +// run-pass +#![feature(box_patterns)] + +#[derive(Debug, PartialEq)] +enum Test { + Foo(usize), + Bar(isize), +} + +fn main() { + let a = Box::new(Test::Foo(10)); + let b = Box::new(Test::Bar(-20)); + match (a, b) { + (_, box Test::Foo(_)) => unreachable!(), + (box Test::Foo(x), b) => { + assert_eq!(x, 10); + assert_eq!(b, Box::new(Test::Bar(-20))); + }, + _ => unreachable!(), + } +} -- cgit v1.2.3