blob: 277e5ef06f34bc7af0b2d8b0e1c89249e5b4812d [file] [log] [blame] [edit]
//@ edition:2015..2021
fn to_fn_once<F: FnOnce()>(f: F) -> F {
f
}
fn f<T: std::fmt::Display>(y: T) {
struct Foo<U: std::fmt::Display> {
x: U,
};
let foo = Foo { x: "x" };
let c = to_fn_once(move || {
println!("{} {}", foo.x, y);
});
c();
c();
//~^ ERROR use of moved value
}
fn main() {
f("S");
}