2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2011-04-13 20:21:06 +00:00
|
|
|
|
2015-03-26 00:06:52 +00:00
|
|
|
fn mk() -> isize { return 1; }
|
2011-04-13 20:21:06 +00:00
|
|
|
|
2015-06-07 18:00:38 +00:00
|
|
|
fn chk(a: isize) { println!("{}", a); assert_eq!(a, 1); }
|
2011-06-15 18:19:50 +00:00
|
|
|
|
2014-02-14 04:23:01 +00:00
|
|
|
fn apply<T>(produce: fn() -> T,
|
|
|
|
consume: fn(T)) {
|
2012-01-11 17:58:05 +00:00
|
|
|
consume(produce());
|
|
|
|
}
|
2011-04-13 20:21:06 +00:00
|
|
|
|
2013-02-02 03:43:17 +00:00
|
|
|
pub fn main() {
|
2015-03-26 00:06:52 +00:00
|
|
|
let produce: fn() -> isize = mk;
|
|
|
|
let consume: fn(v: isize) = chk;
|
|
|
|
apply::<isize>(produce, consume);
|
2011-08-12 13:37:25 +00:00
|
|
|
}
|