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