]>
Commit | Line | Data |
---|---|---|
1a4d82fc | 1 | use std::ops::Add; |
970d7e83 | 2 | |
1a4d82fc | 3 | #[inline] |
c34b1796 AL |
4 | pub fn has_closures() -> usize { |
5 | let x = 1; | |
85aaf69f | 6 | let mut f = move || x; |
c34b1796 | 7 | let y = 1; |
85aaf69f | 8 | let g = || y; |
1a4d82fc | 9 | f() + g() |
223e47cc LB |
10 | } |
11 | ||
1a4d82fc | 12 | pub fn has_generic_closures<T: Add<Output=T> + Copy>(x: T, y: T) -> T { |
85aaf69f SL |
13 | let mut f = move || x; |
14 | let g = || y; | |
1a4d82fc | 15 | f() + g() |
223e47cc | 16 | } |