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