rust/tests/ui/closures/old-closure-fn-coerce.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
240 B
Rust
Raw Normal View History

// run-pass
2020-03-27 20:56:19 +00:00
#![allow(unused_braces)]
fn force<F>(f: F) -> isize where F: FnOnce() -> isize { return f(); }
2015-01-02 22:32:54 +00:00
pub fn main() {
fn f() -> isize { return 7; }
assert_eq!(force(f), 7);
let g = {||force(f)};
assert_eq!(g(), 7);
}