]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/get_default.polonius.stderr
Auto merge of #105121 - oli-obk:simpler-cheaper-dump_mir, r=nnethercote
[rust.git] / src / test / ui / nll / get_default.polonius.stderr
1 error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
2   --> $DIR/get_default.rs:32:17
3    |
4 LL | fn err(map: &mut Map) -> &String {
5    |             - let's call the lifetime of this reference `'1`
6 LL |     loop {
7 LL |         match map.get() {
8    |               --- immutable borrow occurs here
9 LL |             Some(v) => {
10 LL |                 map.set(String::new()); // Both AST and MIR error here
11    |                 ^^^ mutable borrow occurs here
12 LL |
13 LL |                 return v;
14    |                        - returning this value requires that `*map` is borrowed for `'1`
15
16 error: aborting due to previous error
17
18 For more information about this error, try `rustc --explain E0502`.