summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs
blob: ac0a74eebd5e5cd78f6581e5665faf4de24d7da4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::ops::Add;

#[inline]
pub fn has_closures() -> usize {
    let x = 1;
    let mut f = move || x;
    let y = 1;
    let g = || y;
    f() + g()
}

pub fn has_generic_closures<T: Add<Output=T> + Copy>(x: T, y: T) -> T {
    let mut f = move || x;
    let g = || y;
    f() + g()
}