about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/const-generics/const_evaluatable_checked/closures.rs6
-rw-r--r--src/test/ui/const-generics/const_evaluatable_checked/closures.stderr15
2 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/closures.rs b/src/test/ui/const-generics/const_evaluatable_checked/closures.rs
new file mode 100644
index 00000000000..32f43591e37
--- /dev/null
+++ b/src/test/ui/const-generics/const_evaluatable_checked/closures.rs
@@ -0,0 +1,6 @@
+#![feature(const_generics, const_evaluatable_checked)]
+#![allow(incomplete_features)]
+fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
+//~^ ERROR overly complex generic constant
+
+fn main() {}
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/closures.stderr b/src/test/ui/const-generics/const_evaluatable_checked/closures.stderr
new file mode 100644
index 00000000000..7bb23f1488d
--- /dev/null
+++ b/src/test/ui/const-generics/const_evaluatable_checked/closures.stderr
@@ -0,0 +1,15 @@
+error: overly complex generic constant
+  --> $DIR/closures.rs:3:35
+   |
+LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
+   |                                   ^^^^^^^^^^^^^
+   |
+note: unsupported rvalue
+  --> $DIR/closures.rs:3:39
+   |
+LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
+   |                                       ^^^^^^^
+   = help: consider moving this anonymous constant into a `const` function
+
+error: aborting due to previous error
+