rust/tests/ui/borrowck/borrowck-closures-use-after-free.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
589 B
Plaintext
Raw Normal View History

error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-closures-use-after-free.rs:22:8
2018-08-08 12:28:26 +00:00
|
LL | let mut test = |foo: &Foo| {
| ----------- mutable borrow occurs here
LL | ptr = Box::new(Foo { x: ptr.x + 1 });
| --- first borrow occurs due to use of `ptr` in closure
2018-08-08 12:28:26 +00:00
LL | };
2019-03-09 12:03:44 +00:00
LL | test(&*ptr);
| ---- ^^^^^ immutable borrow occurs here
| |
| mutable borrow later used by call
2018-08-08 12:28:26 +00:00
error: aborting due to 1 previous error
2018-08-08 12:28:26 +00:00
For more information about this error, try `rustc --explain E0502`.