From 437f07b3cf68a43b1fbe1c04650aa4d3d9bbbafc Mon Sep 17 00:00:00 2001 From: bohan Date: Fri, 29 Dec 2023 01:13:54 +0800 Subject: [PATCH] add test for #117626 --- tests/ui/pattern/issue-117626.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/ui/pattern/issue-117626.rs diff --git a/tests/ui/pattern/issue-117626.rs b/tests/ui/pattern/issue-117626.rs new file mode 100644 index 00000000000..f87147a5d88 --- /dev/null +++ b/tests/ui/pattern/issue-117626.rs @@ -0,0 +1,21 @@ +// check-pass + +#[derive(PartialEq)] +struct NonMatchable; + +impl Eq for NonMatchable {} + +#[derive(PartialEq, Eq)] +enum Foo { + A(NonMatchable), + B(*const u8), +} + +const CONST: Foo = Foo::B(std::ptr::null()); + +fn main() { + match CONST { + CONST => 0, + _ => 1, + }; +}