summaryrefslogtreecommitdiffstats
path: root/src/test/ui/let-else/const-fn.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/let-else/const-fn.rs')
-rw-r--r--src/test/ui/let-else/const-fn.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/let-else/const-fn.rs b/src/test/ui/let-else/const-fn.rs
new file mode 100644
index 000000000..336b0b4b7
--- /dev/null
+++ b/src/test/ui/let-else/const-fn.rs
@@ -0,0 +1,19 @@
+// run-pass
+// issue #101932
+
+#![cfg_attr(bootstrap, feature(let_else))]
+
+const fn foo(a: Option<i32>) -> i32 {
+ let Some(a) = a else {
+ return 42
+ };
+
+ a + 1
+}
+
+fn main() {
+ const A: i32 = foo(None);
+ const B: i32 = foo(Some(1));
+
+ println!("{} {}", A, B);
+}