about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-10-27 13:34:35 +0200
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-10-27 13:34:35 +0200
commitc04893afbb1bccc2ceeccdd7b7f46e5cb5dc126d (patch)
treeb8f1f97c7acae4d43da68d99514a37041b53c811 /src/test
parent3e6f30ec3e6bda159063fcd126dcb14725fef92d (diff)
downloadrust-c04893afbb1bccc2ceeccdd7b7f46e5cb5dc126d.tar.gz
rust-c04893afbb1bccc2ceeccdd7b7f46e5cb5dc126d.zip
Fix an ICE in the min_const_fn analysis
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/consts/single_variant_match_ice.rs15
-rw-r--r--src/test/ui/consts/single_variant_match_ice.stderr8
2 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/consts/single_variant_match_ice.rs b/src/test/ui/consts/single_variant_match_ice.rs
new file mode 100644
index 00000000000..67a41bc5dc4
--- /dev/null
+++ b/src/test/ui/consts/single_variant_match_ice.rs
@@ -0,0 +1,15 @@
+enum Foo {
+    Prob,
+}
+
+impl Foo {
+    pub const fn as_val(&self) -> u8 {
+        use self::Foo::*;
+
+        match *self {
+            Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
+        }
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/single_variant_match_ice.stderr b/src/test/ui/consts/single_variant_match_ice.stderr
new file mode 100644
index 00000000000..a0222b0d489
--- /dev/null
+++ b/src/test/ui/consts/single_variant_match_ice.stderr
@@ -0,0 +1,8 @@
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+  --> $DIR/single_variant_match_ice.rs:10:13
+   |
+LL |             Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
+   |             ^^^^
+
+error: aborting due to previous error
+