blob: 504b4adbeb9bc1e579c47a5ff73b0c37b0a16ce0 [file] [log] [blame] [edit]
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");
}