about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/const-generics/default-ty-closure.rs6
-rw-r--r--tests/ui/const-generics/default-ty-closure.stderr10
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/const-generics/default-ty-closure.rs b/tests/ui/const-generics/default-ty-closure.rs
new file mode 100644
index 00000000000..36128505dda
--- /dev/null
+++ b/tests/ui/const-generics/default-ty-closure.rs
@@ -0,0 +1,6 @@
+// https://github.com/rust-lang/rust/issues/116796
+
+struct X<const FN: fn() = { || {} }>;
+//~^ ERROR using function pointers as const generic parameters is forbidden
+
+fn main() {}
diff --git a/tests/ui/const-generics/default-ty-closure.stderr b/tests/ui/const-generics/default-ty-closure.stderr
new file mode 100644
index 00000000000..9c737c1a19d
--- /dev/null
+++ b/tests/ui/const-generics/default-ty-closure.stderr
@@ -0,0 +1,10 @@
+error: using function pointers as const generic parameters is forbidden
+  --> $DIR/default-ty-closure.rs:3:20
+   |
+LL | struct X<const FN: fn() = { || {} }>;
+   |                    ^^^^
+   |
+   = note: the only supported types are integers, `bool` and `char`
+
+error: aborting due to 1 previous error
+