diff options
Diffstat (limited to 'tests/ui/unboxed-closures/unboxed-closures-infer-fnmut-move.rs')
-rw-r--r-- | tests/ui/unboxed-closures/unboxed-closures-infer-fnmut-move.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/unboxed-closures/unboxed-closures-infer-fnmut-move.rs b/tests/ui/unboxed-closures/unboxed-closures-infer-fnmut-move.rs new file mode 100644 index 000000000..7ac1ae30f --- /dev/null +++ b/tests/ui/unboxed-closures/unboxed-closures-infer-fnmut-move.rs @@ -0,0 +1,16 @@ +// run-pass +// Test that we are able to infer a suitable kind for this `move` +// closure that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + + let v = { + let mut tick = move || { counter += 1; counter }; + tick(); + tick() + }; + + assert_eq!(counter, 0); + assert_eq!(v, 2); +} |