2018-07-15 21:11:54 +00:00
|
|
|
error[E0499]: cannot borrow `y` as mutable more than once at a time
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-18783.rs:7:21
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
|
LL | c.push(Box::new(|| y = 0));
|
2019-04-22 07:40:08 +00:00
|
|
|
| -- - first borrow occurs due to use of `y` in closure
|
2018-07-15 21:11:54 +00:00
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
|
|
|
LL | c.push(Box::new(|| y = 0));
|
2019-04-22 07:40:08 +00:00
|
|
|
| ^^ - second borrow occurs due to use of `y` in closure
|
2018-07-15 21:11:54 +00:00
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2019-03-09 12:03:44 +00:00
|
|
|
LL |
|
2018-07-15 21:11:54 +00:00
|
|
|
LL | }
|
2020-09-02 07:40:56 +00:00
|
|
|
| - first borrow might be used here, when `c` is dropped and runs the destructor for type `RefCell<Vec<Box<dyn FnMut()>>>`
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
error[E0499]: cannot borrow `y` as mutable more than once at a time
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/issue-18783.rs:16:29
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
|
LL | Push::push(&c, Box::new(|| y = 0));
|
2019-04-22 07:40:08 +00:00
|
|
|
| -- - first borrow occurs due to use of `y` in closure
|
2018-07-15 21:11:54 +00:00
|
|
|
| |
|
|
|
|
| first mutable borrow occurs here
|
|
|
|
LL | Push::push(&c, Box::new(|| y = 0));
|
2019-04-22 07:40:08 +00:00
|
|
|
| ^^ - second borrow occurs due to use of `y` in closure
|
2018-07-15 21:11:54 +00:00
|
|
|
| |
|
|
|
|
| second mutable borrow occurs here
|
2019-03-09 12:03:44 +00:00
|
|
|
LL |
|
2018-07-15 21:11:54 +00:00
|
|
|
LL | }
|
2020-09-02 07:40:56 +00:00
|
|
|
| - first borrow might be used here, when `c` is dropped and runs the destructor for type `RefCell<Vec<Box<dyn FnMut()>>>`
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0499`.
|