]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/2229_closure_analysis/diagnostics/closure-origin-array-diagnostics.stderr
Rollup merge of #106106 - jyn514:remote-tracking-branch, r=Mark-Simulacrum
[rust.git] / tests / ui / closures / 2229_closure_analysis / diagnostics / closure-origin-array-diagnostics.stderr
1 error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
2   --> $DIR/closure-origin-array-diagnostics.rs:9:13
3    |
4 LL |     let c = || {
5    |             ^^ this closure implements `FnOnce`, not `Fn`
6 LL |         let [_, _s] = s;
7    |                       - closure is `FnOnce` because it moves the variable `s` out of its environment
8 LL |     };
9 LL |     expect_fn(c);
10    |     --------- - the requirement to implement `Fn` derives from here
11    |     |
12    |     required by a bound introduced by this call
13    |
14 note: required by a bound in `expect_fn`
15   --> $DIR/closure-origin-array-diagnostics.rs:5:17
16    |
17 LL | fn expect_fn<F: Fn()>(_f: F) {}
18    |                 ^^^^ required by this bound in `expect_fn`
19
20 error: aborting due to previous error
21
22 For more information about this error, try `rustc --explain E0525`.