diff options
Diffstat (limited to 'src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs')
-rw-r--r-- | src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs b/src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs new file mode 100644 index 000000000..8665cfc21 --- /dev/null +++ b/src/test/ui/functions-closures/closure-expected-type/supply-nothing.rs @@ -0,0 +1,11 @@ +// run-pass +fn with_closure<F>(f: F) -> u32 + where F: FnOnce(&u32, &u32) -> u32 +{ + f(&22, &44) +} + +fn main() { + let z = with_closure(|x, y| x + y).wrapping_add(1); + assert_eq!(z, 22 + 44 + 1); +} |