2025-03-06 18:06:48 -03:00

17 lines
706 B
Plaintext

error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
--> $DIR/fn-once.rs:7:19
|
LL | let closure = use || {
| ^^^^^^ this closure implements `FnOnce`, not `Fn`
LL | vec
| --- closure is `FnOnce` because it moves the variable `vec` out of its environment
...
LL | Box::new(closure)
| ----------------- the requirement to implement `Fn` derives from here
|
= note: required for the cast from `Box<{closure@$DIR/fn-once.rs:7:19: 7:25}>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0525`.