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