about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-26 10:26:54 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-30 09:44:06 +0100
commit866664c8bb1a3f1eb7fa60c8d8243535675ea78f (patch)
treedbdde49e512a626e380dc6e28688072a0a8477ba
parentd8ece188b88569da794c2916ee6034a1054d2f35 (diff)
downloadrust-866664c8bb1a3f1eb7fa60c8d8243535675ea78f.tar.gz
rust-866664c8bb1a3f1eb7fa60c8d8243535675ea78f.zip
Add a test for single variant matches
-rw-r--r--src/test/ui/consts/single_variant_match_ice.rs8
-rw-r--r--src/test/ui/consts/single_variant_match_ice.stderr17
2 files changed, 23 insertions, 2 deletions
diff --git a/src/test/ui/consts/single_variant_match_ice.rs b/src/test/ui/consts/single_variant_match_ice.rs
index 67a41bc5dc4..79dde3c18e8 100644
--- a/src/test/ui/consts/single_variant_match_ice.rs
+++ b/src/test/ui/consts/single_variant_match_ice.rs
@@ -2,6 +2,14 @@ enum Foo {
     Prob,
 }
 
+const FOO: u32 = match Foo::Prob {
+    Foo::Prob => 42, //~ ERROR unimplemented expression type
+};
+
+const BAR: u32 = match Foo::Prob {
+    x => 42, //~ ERROR unimplemented expression type
+};
+
 impl Foo {
     pub const fn as_val(&self) -> u8 {
         use self::Foo::*;
diff --git a/src/test/ui/consts/single_variant_match_ice.stderr b/src/test/ui/consts/single_variant_match_ice.stderr
index a0222b0d489..f5c2cb5e0e9 100644
--- a/src/test/ui/consts/single_variant_match_ice.stderr
+++ b/src/test/ui/consts/single_variant_match_ice.stderr
@@ -1,8 +1,21 @@
+error[E0019]: constant contains unimplemented expression type
+  --> $DIR/single_variant_match_ice.rs:6:5
+   |
+LL |     Foo::Prob => 42, //~ ERROR unimplemented expression type
+   |     ^^^^^^^^^
+
+error[E0019]: constant contains unimplemented expression type
+  --> $DIR/single_variant_match_ice.rs:10:5
+   |
+LL |     x => 42, //~ ERROR unimplemented expression type
+   |     ^
+
 error: `if`, `match`, `&&` and `||` are not stable in const fn
-  --> $DIR/single_variant_match_ice.rs:10:13
+  --> $DIR/single_variant_match_ice.rs:18:13
    |
 LL |             Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
    |             ^^^^
 
-error: aborting due to previous error
+error: aborting due to 3 previous errors
 
+For more information about this error, try `rustc --explain E0019`.