about summary refs log tree commit diff
path: root/tests/ui/unboxed-closures/unboxed-closures-infer-fnmut.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/unboxed-closures/unboxed-closures-infer-fnmut.rs')
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-infer-fnmut.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/unboxed-closures/unboxed-closures-infer-fnmut.rs b/tests/ui/unboxed-closures/unboxed-closures-infer-fnmut.rs
new file mode 100644
index 00000000000..0fbb504c2ba
--- /dev/null
+++ b/tests/ui/unboxed-closures/unboxed-closures-infer-fnmut.rs
@@ -0,0 +1,15 @@
+// run-pass
+// Test that we are able to infer a suitable kind for this closure
+// that is just called (`FnMut`).
+
+fn main() {
+    let mut counter = 0;
+
+    {
+        let mut tick = || counter += 1;
+        tick();
+        tick();
+    }
+
+    assert_eq!(counter, 2);
+}