about summary refs log tree commit diff
path: root/tests/ui/c-variadic/no-closure.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/c-variadic/no-closure.rs')
-rw-r--r--tests/ui/c-variadic/no-closure.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/c-variadic/no-closure.rs b/tests/ui/c-variadic/no-closure.rs
new file mode 100644
index 00000000000..c0b77786e8b
--- /dev/null
+++ b/tests/ui/c-variadic/no-closure.rs
@@ -0,0 +1,17 @@
+#![feature(c_variadic)]
+#![crate_type = "lib"]
+
+// Check that `...` in closures is rejected.
+
+const F: extern "C" fn(...) = |_: ...| {};
+//~^ ERROR C-variadic type `...` may not be nested inside another type
+
+fn foo() {
+    let f = |...| {};
+    //~^ ERROR: `..` patterns are not allowed here
+    //~| ERROR: unexpected `...`
+
+    let f = |_: ...| {};
+    //~^ ERROR C-variadic type `...` may not be nested inside another type
+    f(1i64)
+}