2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_parens)]
|
2015-03-22 20:13:15 +00:00
|
|
|
// 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
|
|
|
|
2013-02-02 03:43:17 +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(||{});
|
2015-02-01 17:44:15 +00:00
|
|
|
let _ = (||{});
|
2012-07-26 21:29:24 +00:00
|
|
|
}
|