From 214eef043501a896ec375fc831891cf1dc09219f Mon Sep 17 00:00:00 2001 From: hyd-dev Date: Mon, 6 Sep 2021 23:58:10 +0800 Subject: [PATCH] Add a regression test for https://github.com/rust-lang/rust/issues/88649 --- src/test/ui/consts/issue-88649.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/test/ui/consts/issue-88649.rs diff --git a/src/test/ui/consts/issue-88649.rs b/src/test/ui/consts/issue-88649.rs new file mode 100644 index 00000000000..43e562b5a7d --- /dev/null +++ b/src/test/ui/consts/issue-88649.rs @@ -0,0 +1,18 @@ +// check-pass +#![crate_type = "lib"] + +enum Foo { + Variant1(bool), + Variant2(bool), +} + +const _: () = { + let mut n = 0; + while n < 2 { + match Foo::Variant1(true) { + Foo::Variant1(x) | Foo::Variant2(x) if x => {} + _ => {} + } + n += 1; + } +};