rust/src/test/run-pass/block-arg-call-as.rs
2018-12-25 21:08:33 -07:00

11 lines
170 B
Rust

#![allow(non_snake_case)]
fn asBlock<F>(f: F) -> usize where F: FnOnce() -> usize {
return f();
}
pub fn main() {
let x = asBlock(|| 22);
assert_eq!(x, 22);
}