os-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 17:32:54 -05:00
fn f<T, F>(g: F) -> T where F: FnOnce() -> T { g() }
2012-07-26 14:29:24 -07:00
pub fn main() {
2015-01-25 22:05:03 +01:00
let _x = f( | | { 10 });
2012-07-26 14:29:24 -07: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 14:29:24 -07:00
}