]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
223e47cc | 2 | |
c34b1796 AL |
3 | fn takes_two(x: &isize, y: &isize) -> isize { *x + *y } |
4 | ||
5 | fn with<T, F>(f: F) -> T where F: FnOnce(&isize) -> T { | |
223e47cc LB |
6 | f(&20) |
7 | } | |
8 | ||
c34b1796 | 9 | fn has_one<'a>(x: &'a isize) -> isize { |
1a4d82fc | 10 | with(|y| takes_two(x, y)) |
223e47cc LB |
11 | } |
12 | ||
13 | pub fn main() { | |
970d7e83 | 14 | assert_eq!(has_one(&2), 22); |
223e47cc | 15 | } |