]> git.lizzy.rs Git - rust.git/commitdiff
Add a test for single variant matches
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 26 Nov 2018 09:26:54 +0000 (10:26 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 30 Nov 2018 08:44:06 +0000 (09:44 +0100)
src/test/ui/consts/single_variant_match_ice.rs
src/test/ui/consts/single_variant_match_ice.stderr

index 67a41bc5dc4addaa52b0efeeb9612c3b3f1ebb8d..79dde3c18e8fa995ed58414fb85beb8dec9a39b1 100644 (file)
@@ -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::*;
index a0222b0d489a465c33d3441e4e99f59ebb54f281..f5c2cb5e0e9dcb95931e6e7d07a0cea6f4ac8967 100644 (file)
@@ -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`.