rust/tests/ui/unsized-locals/box-fnonce.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
178 B
Rust
Raw Normal View History

//@ run-pass
2018-10-28 06:28:47 +00:00
fn call_it<T>(f: Box<dyn FnOnce() -> T>) -> T {
f()
}
fn main() {
let s = "hello".to_owned();
assert_eq!(&call_it(Box::new(|| s)) as &str, "hello");
}