]> git.proxmox.com Git - rustc.git/blob - tests/ui/functions-closures/closure-inference.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / functions-closures / closure-inference.rs
1 // run-pass
2 #![allow(unused_braces)]
3
4 fn foo(i: isize) -> isize { i + 1 }
5
6 fn apply<A, F>(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) }
7
8 pub fn main() {
9 let f = {|i| foo(i)};
10 assert_eq!(apply(f, 2), 3);
11 }