summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-unwrap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/const-unwrap.rs')
-rw-r--r--tests/ui/consts/const-unwrap.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/consts/const-unwrap.rs b/tests/ui/consts/const-unwrap.rs
new file mode 100644
index 000000000..729ae535c
--- /dev/null
+++ b/tests/ui/consts/const-unwrap.rs
@@ -0,0 +1,13 @@
+// check-fail
+
+#![feature(const_option)]
+
+const FOO: i32 = Some(42i32).unwrap();
+
+const BAR: i32 = Option::<i32>::None.unwrap();
+//~^ERROR: evaluation of constant value failed
+
+fn main() {
+ println!("{}", FOO);
+ println!("{}", BAR);
+}