]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/closures-in-loops.stderr
692eaea92b83bc6c641e07eedf8c98ce11bc52ef
[rust.git] / src / test / ui / nll / closures-in-loops.stderr
1 error[E0382]: use of moved value: `x`
2   --> $DIR/closures-in-loops.rs:8:9
3    |
4 LL | fn repreated_move(x: String) {
5    |                   - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
6 LL |     for i in 0..10 {
7 LL |         || x;
8    |         ^^ - use occurs due to use in closure
9    |         |
10    |         value moved into closure here, in previous iteration of loop
11
12 error[E0499]: cannot borrow `x` as mutable more than once at a time
13   --> $DIR/closures-in-loops.rs:15:16
14    |
15 LL |         v.push(|| x = String::new());
16    |                ^^ - borrows occur due to use of `x` in closure
17    |                |
18    |                mutable borrow starts here in previous iteration of loop
19
20 error[E0524]: two closures require unique access to `x` at the same time
21   --> $DIR/closures-in-loops.rs:22:16
22    |
23 LL |         v.push(|| *x = String::new());
24    |                ^^  - borrows occur due to use of `x` in closure
25    |                |
26    |                closures are constructed here in different iterations of loop
27
28 error: aborting due to 3 previous errors
29
30 Some errors have detailed explanations: E0382, E0499.
31 For more information about an error, try `rustc --explain E0382`.