mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
18 lines
285 B
Rust
18 lines
285 B
Rust
// run-pass
|
|
|
|
fn f(i: isize, called: &mut bool) {
|
|
assert_eq!(i, 10);
|
|
*called = true;
|
|
}
|
|
|
|
fn g(f: fn(isize, v: &mut bool), called: &mut bool) {
|
|
f(10, called);
|
|
}
|
|
|
|
pub fn main() {
|
|
let mut called = false;
|
|
let h = f;
|
|
g(h, &mut called);
|
|
assert_eq!(called, true);
|
|
}
|