about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-11-26 17:56:23 -0600
committerGitHub <noreply@github.com>2019-11-26 17:56:23 -0600
commit7f166e44ff187b517342a5ace95665743b2d222f (patch)
treebf173515e0b431d858de58f753931bde521dc77b
parent84a2d6637425c24d1718d42427621b09a3689b59 (diff)
parentf1f83ef8f84c15ab5292cd2dbbb0c7b0f14cbc1e (diff)
downloadrust-7f166e44ff187b517342a5ace95665743b2d222f.tar.gz
rust-7f166e44ff187b517342a5ace95665743b2d222f.zip
Rollup merge of #66786 - jyn514:const-if-match-tests, r=Centril
Add wildcard test for const_if_match

Closes https://github.com/rust-lang/rust/issues/66758

Many thanks to @Centril for his help getting me started!
-rw-r--r--src/test/ui/consts/control-flow/single-arm-match-wild.rs21
1 files changed, 21 insertions, 0 deletions
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
new file mode 100644
index 00000000000..fba6e3583cc
--- /dev/null
+++ b/src/test/ui/consts/control-flow/single-arm-match-wild.rs
@@ -0,0 +1,21 @@
+// 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);
+}