2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn f(i: isize, called: &mut bool) {
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(i, 10);
|
2012-10-05 22:07:53 -07:00
|
|
|
*called = true;
|
2011-10-10 14:03:25 -07:00
|
|
|
}
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn g(f: fn(isize, v: &mut bool), called: &mut bool) {
|
2011-10-10 14:03:25 -07:00
|
|
|
f(10, called);
|
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2012-03-22 08:39:41 -07:00
|
|
|
let mut called = false;
|
2011-10-10 14:03:25 -07:00
|
|
|
let h = f;
|
2012-10-05 22:07:53 -07:00
|
|
|
g(h, &mut called);
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(called, true);
|
2013-02-14 11:47:00 -08:00
|
|
|
}
|