rust/tests/ui/issues/issue-12127.rs

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

15 lines
328 B
Rust
Raw Normal View History

2022-07-30 05:37:48 +00:00
#![feature(unboxed_closures, tuple_trait)]
2015-01-08 02:53:58 +00:00
2022-07-30 05:37:48 +00:00
fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f }
fn do_it(x: &isize) { }
fn main() {
let x: Box<_> = Box::new(22);
let f = to_fn_once(move|| do_it(&*x));
to_fn_once(move|| {
f();
f();
//~^ ERROR: use of moved value: `f`
})()
}