]> git.lizzy.rs Git - rust.git/blob - tests/ui/functions-closures/closure-inference.rs
Rollup merge of #107740 - oli-obk:lock_tcx, r=petrochenkov
[rust.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 }