mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 21:16:27 +03:00
16 lines
171 B
Rust
16 lines
171 B
Rust
fn f() -> i32 {
|
|
42
|
|
}
|
|
|
|
fn return_fn_ptr() -> fn() -> i32 {
|
|
f
|
|
}
|
|
|
|
fn call_fn_ptr() -> i32 {
|
|
return_fn_ptr()()
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(call_fn_ptr(), 42);
|
|
}
|