From 9617d7c88784469b12d194eb6db084838952a3f4 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 27 Nov 2019 00:02:04 -0500 Subject: [PATCH] Combine similar tests for const match See https://github.com/rust-lang/rust/pull/66788#issuecomment-558799307 for context. --- .../exhaustive-c-like-enum-match.rs | 12 ++++++++++- .../control-flow/single-arm-match-wild.rs | 21 ------------------- 2 files changed, 11 insertions(+), 22 deletions(-) delete mode 100644 src/test/ui/consts/control-flow/single-arm-match-wild.rs diff --git a/src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs b/src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs index 9e22151f2e9..6bbbdd972a2 100644 --- a/src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs +++ b/src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs @@ -18,4 +18,14 @@ const fn f(e: E) { } } -fn main() {} +const fn g(e: E) -> usize { + match e { + _ => 0 + } +} + +fn main() { + const X: usize = g(E::C); + assert_eq!(X, 0); + assert_eq!(g(E::A), 0); +} diff --git a/src/test/ui/consts/control-flow/single-arm-match-wild.rs b/src/test/ui/consts/control-flow/single-arm-match-wild.rs deleted file mode 100644 index fba6e3583cc..00000000000 --- a/src/test/ui/consts/control-flow/single-arm-match-wild.rs +++ /dev/null @@ -1,21 +0,0 @@ -// check-pass - -#![feature(const_if_match)] - -enum E { - A, - B, - C -} - -const fn f(e: E) -> usize { - match e { - _ => 0 - } -} - -fn main() { - const X: usize = f(E::C); - assert_eq!(X, 0); - assert_eq!(f(E::A), 0); -} -- 2.44.0