]> git.lizzy.rs Git - rust.git/blob - src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr
Use structured suggestion when requiring `Copy` constraint in type param
[rust.git] / src / test / ui / moves / moves-based-on-type-no-recursive-stack-closure.stderr
1 error[E0499]: cannot borrow `*f` as mutable more than once at a time
2   --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:20:27
3    |
4 LL |                     (f.c)(f, true);
5    |                     ----- ^ second mutable borrow occurs here
6    |                     |
7    |                     first mutable borrow occurs here
8    |                     first borrow later used by call
9
10 error[E0382]: borrow of moved value: `f`
11   --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:32:5
12    |
13 LL | fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) {
14    |                   -----                                 - help: consider further restricting type parameter `F`: `, F: Copy`
15    |                   |
16    |                   move occurs because `f` has type `F`, which does not implement the `Copy` trait
17 LL |     let mut r = R {c: Box::new(f)};
18    |                                - value moved here
19 LL |     f(&mut r, false)
20    |     ^ value borrowed here after move
21
22 error: aborting due to 2 previous errors
23
24 Some errors have detailed explanations: E0382, E0499.
25 For more information about an error, try `rustc --explain E0382`.