rust/tests/ui/closures/issue-868.rs

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

19 lines
426 B
Rust
Raw Normal View History

// run-pass
#![allow(unused_parens)]
// pretty-expanded FIXME #23616
2015-01-02 22:32:54 +00:00
fn f<T, F>(g: F) -> T where F: FnOnce() -> T { g() }
2012-07-26 21:29:24 +00:00
pub fn main() {
2015-01-25 21:05:03 +00:00
let _x = f( | | { 10 });
2012-07-26 21:29:24 +00:00
// used to be: cannot determine a type for this expression
f(| | { });
// ditto
f( | | { ()});
// always worked
let _: () = f(| | { });
// empty block with no type info should compile too
let _ = f(||{});
let _ = (||{});
2012-07-26 21:29:24 +00:00
}