2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
|
|
|
|
2018-09-14 12:20:28 +02:00
|
|
|
#![allow(non_snake_case)]
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn asBlock<F>(f: F) -> usize where F: FnOnce() -> usize {
|
2012-08-01 17:30:05 -07:00
|
|
|
return f();
|
2011-12-29 20:07:55 -08:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2015-03-03 10:42:26 +02:00
|
|
|
let x = asBlock(|| 22);
|
|
|
|
assert_eq!(x, 22);
|
2011-12-29 20:07:55 -08:00
|
|
|
}
|