]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/print/closure-print-generic-1.rs
Rollup merge of #106321 - compiler-errors:delayed-bug-backtrace, r=Nilstrieb
[rust.git] / tests / ui / closures / print / closure-print-generic-1.rs
1 fn to_fn_once<F: FnOnce()>(f: F) -> F {
2     f
3 }
4
5 fn f<T: std::fmt::Display>(y: T) {
6     struct Foo<U: std::fmt::Display> {
7         x: U,
8     };
9
10     let foo = Foo { x: "x" };
11
12     let c = to_fn_once(move || {
13         println!("{} {}", foo.x, y);
14     });
15
16     c();
17     c();
18     //~^ ERROR use of moved value
19 }
20
21 fn main() {
22     f("S");
23 }