rust/tests/ui/closures/closure-wrong-kind.stderr

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

22 lines
826 B
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
2018-12-25 09:56:47 -06:00
--> $DIR/closure-wrong-kind.rs:10:19
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | let closure = |_| foo(x);
2022-06-27 00:45:35 -05:00
| ^^^ - closure is `FnOnce` because it moves the variable `x` out of its environment
| |
2018-08-08 07:28:26 -05:00
| this closure implements `FnOnce`, not `Fn`
LL | bar(closure);
2022-08-18 07:22:07 -05:00
| --- ------- the requirement to implement `Fn` derives from here
| |
| required by a bound introduced by this call
|
note: required by a bound in `bar`
--> $DIR/closure-wrong-kind.rs:6:11
|
LL | fn bar<T: Fn(u32)>(_: T) {}
| ^^^^^^^ required by this bound in `bar`
2018-08-08 07:28:26 -05:00
error: aborting due to previous error
For more information about this error, try `rustc --explain E0525`.