summaryrefslogtreecommitdiffstats
path: root/tests/ui/generics/generic-temporary.rs
blob: b63b534d03f12fa94b38989e6300b29c13b5a884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass

fn mk() -> isize { return 1; }

fn chk(a: isize) { println!("{}", a); assert_eq!(a, 1); }

fn apply<T>(produce: fn() -> T,
            consume: fn(T)) {
    consume(produce());
}

pub fn main() {
    let produce: fn() -> isize = mk;
    let consume: fn(v: isize) = chk;
    apply::<isize>(produce, consume);
}