rust/src/test/ui/block-fn-coerce.rs
2019-07-27 18:56:16 +03:00

11 lines
215 B
Rust

// run-pass
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);
}