diff options
Diffstat (limited to 'tests/ui/newlambdas.rs')
-rw-r--r-- | tests/ui/newlambdas.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/newlambdas.rs b/tests/ui/newlambdas.rs new file mode 100644 index 000000000..90de53856 --- /dev/null +++ b/tests/ui/newlambdas.rs @@ -0,0 +1,14 @@ +// run-pass +// Tests for the new |args| expr lambda syntax + + +fn f<F>(i: isize, f: F) -> isize where F: FnOnce(isize) -> isize { f(i) } + +fn g<G>(_g: G) where G: FnOnce() { } + +pub fn main() { + assert_eq!(f(10, |a| a), 10); + g(||()); + assert_eq!(f(10, |a| a), 10); + g(||{}); +} |