summaryrefslogtreecommitdiffstats
path: root/src/test/ui/closures/closure-no-fn-1.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/closures/closure-no-fn-1.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/ui/closures/closure-no-fn-1.rs b/src/test/ui/closures/closure-no-fn-1.rs
new file mode 100644
index 000000000..48c3e4725
--- /dev/null
+++ b/src/test/ui/closures/closure-no-fn-1.rs
@@ -0,0 +1,8 @@
+// Ensure that capturing closures are never coerced to fns
+// Especially interesting as non-capturing closures can be.
+
+fn main() {
+ let mut a = 0u8;
+ let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
+ //~^ ERROR mismatched types
+}