2019-04-22 07:40:08 +00:00
|
|
|
error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
|
|
|
|
--> $DIR/issue-11192.rs:20:10
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
|
LL | let mut test = |foo: &Foo| {
|
|
|
|
| ----------- mutable borrow occurs here
|
|
|
|
LL | println!("access {}", foo.x);
|
2022-07-07 02:36:10 +00:00
|
|
|
LL | ptr = Box::new(Foo { x: ptr.x + 1 });
|
2021-03-17 06:51:27 +00:00
|
|
|
| --- first borrow occurs due to use of `ptr` in closure
|
2018-07-15 21:11:54 +00:00
|
|
|
...
|
|
|
|
LL | test(&*ptr);
|
2019-04-22 07:40:08 +00:00
|
|
|
| ---- ^^^^^ immutable borrow occurs here
|
|
|
|
| |
|
|
|
|
| mutable borrow later used by call
|
2018-07-15 21:11:54 +00:00
|
|
|
|
2023-11-21 15:44:16 +00:00
|
|
|
error: aborting due to 1 previous error
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0502`.
|