fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.4 KiB33 linesraw
1error[E0499]: cannot borrow `y` as mutable more than once at a time
2  --> $DIR/issue-18783.rs:7:21
3   |
4LL |     c.push(Box::new(|| y = 0));
5   |                     -- - first borrow occurs due to use of `y` in closure
6   |                     |
7   |                     first mutable borrow occurs here
8LL |     c.push(Box::new(|| y = 0));
9   |                     ^^ - second borrow occurs due to use of `y` in closure
10   |                     |
11   |                     second mutable borrow occurs here
12LL |
13LL | }
14   | - first borrow might be used here, when `c` is dropped and runs the destructor for type `RefCell<Vec<Box<dyn FnMut()>>>`
15
16error[E0499]: cannot borrow `y` as mutable more than once at a time
17  --> $DIR/issue-18783.rs:16:29
18   |
19LL |     Push::push(&c, Box::new(|| y = 0));
20   |                             -- - first borrow occurs due to use of `y` in closure
21   |                             |
22   |                             first mutable borrow occurs here
23LL |     Push::push(&c, Box::new(|| y = 0));
24   |                             ^^ - second borrow occurs due to use of `y` in closure
25   |                             |
26   |                             second mutable borrow occurs here
27LL |
28LL | }
29   | - first borrow might be used here, when `c` is dropped and runs the destructor for type `RefCell<Vec<Box<dyn FnMut()>>>`
30
31error: aborting due to 2 previous errors
32
33For more information about this error, try `rustc --explain E0499`.