rust/src/test/run-pass/block-fn-coerce.rs
2018-12-25 21:08:33 -07:00

9 lines
202 B
Rust

fn force<F>(f: F) -> isize where F: FnOnce() -> isize { return f(); }
pub fn main() {
fn f() -> isize { return 7; }
assert_eq!(force(f), 7);
let g = {||force(f)};
assert_eq!(g(), 7);
}