]> git.proxmox.com Git - rustc.git/blame - src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / ui / borrowck / borrowck-closures-two-mut-fail.nll.stderr
CommitLineData
b7449926
XL
1error[E0499]: cannot borrow `x` as mutable more than once at a time
2 --> $DIR/borrowck-closures-two-mut-fail.rs:26:24
3 |
4LL | let c1 = to_fn_mut(|| x = 4);
5 | -- - first borrow occurs due to use of `x` in closure
6 | |
7 | first mutable borrow occurs here
8LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
9 | ^^ - second borrow occurs due to use of `x` in closure
10 | |
11 | second mutable borrow occurs here
12LL | c1;
0bf4aa26 13 | -- first borrow later used here
b7449926
XL
14
15error[E0499]: cannot borrow `x` as mutable more than once at a time
16 --> $DIR/borrowck-closures-two-mut-fail.rs:37:24
17 |
18LL | let c1 = to_fn_mut(|| set(&mut x));
19 | -- - first borrow occurs due to use of `x` in closure
20 | |
21 | first mutable borrow occurs here
22LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
23 | ^^ - second borrow occurs due to use of `x` in closure
24 | |
25 | second mutable borrow occurs here
26LL | c1;
0bf4aa26 27 | -- first borrow later used here
b7449926
XL
28
29error[E0499]: cannot borrow `x` as mutable more than once at a time
30 --> $DIR/borrowck-closures-two-mut-fail.rs:44:24
31 |
32LL | let c1 = to_fn_mut(|| x = 5);
33 | -- - first borrow occurs due to use of `x` in closure
34 | |
35 | first mutable borrow occurs here
36LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
37 | ^^ - second borrow occurs due to use of `x` in closure
38 | |
39 | second mutable borrow occurs here
40LL | c1;
0bf4aa26 41 | -- first borrow later used here
b7449926
XL
42
43error[E0499]: cannot borrow `x` as mutable more than once at a time
44 --> $DIR/borrowck-closures-two-mut-fail.rs:51:24
45 |
46LL | let c1 = to_fn_mut(|| x = 5);
47 | -- - first borrow occurs due to use of `x` in closure
48 | |
49 | first mutable borrow occurs here
50LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
51 | ^^ - second borrow occurs due to use of `x` in closure
52 | |
53 | second mutable borrow occurs here
54LL | //~^ ERROR cannot borrow `x` as mutable more than once
55LL | c1;
0bf4aa26 56 | -- first borrow later used here
b7449926
XL
57
58error[E0499]: cannot borrow `x` as mutable more than once at a time
59 --> $DIR/borrowck-closures-two-mut-fail.rs:63:24
60 |
61LL | let c1 = to_fn_mut(|| set(&mut *x.f));
62 | -- - first borrow occurs due to use of `x` in closure
63 | |
64 | first mutable borrow occurs here
65LL | let c2 = to_fn_mut(|| set(&mut *x.f));
66 | ^^ - second borrow occurs due to use of `x` in closure
67 | |
68 | second mutable borrow occurs here
69LL | //~^ ERROR cannot borrow `x` as mutable more than once
70LL | c1;
0bf4aa26 71 | -- first borrow later used here
b7449926
XL
72
73error: aborting due to 5 previous errors
74
75For more information about this error, try `rustc --explain E0499`.