summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-params.rs
blob: 04f3b8eaf57f3fa90bf63e92261d0fb852f8a43b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// run-pass
#![allow(unused_parens)]


fn region_identity(x: &usize) -> &usize { x }

fn apply<T, F>(t: T, f: F) -> T where F: FnOnce(T) -> T { f(t) }

fn parameterized(x: &usize) -> usize {
    let z = apply(x, ({|y|
        region_identity(y)
    }));
    *z
}

pub fn main() {
    let x = 3;
    assert_eq!(parameterized(&x), 3);
}