1 error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
2 --> $DIR/get_default.rs:21:17
4 LL | fn ok(map: &mut Map) -> &String {
5 | - let's call the lifetime of this reference `'1`
8 | --- immutable borrow occurs here
11 | - returning this value requires that `*map` is borrowed for `'1`
13 LL | map.set(String::new()); // Ideally, this would not error.
14 | ^^^ mutable borrow occurs here
16 error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
17 --> $DIR/get_default.rs:32:17
19 LL | fn err(map: &mut Map) -> &String {
20 | - let's call the lifetime of this reference `'1`
22 LL | match map.get() {
23 | --- immutable borrow occurs here
25 LL | map.set(String::new()); // Both AST and MIR error here
26 | ^^^ mutable borrow occurs here
29 | - returning this value requires that `*map` is borrowed for `'1`
31 error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
32 --> $DIR/get_default.rs:37:17
34 LL | fn err(map: &mut Map) -> &String {
35 | - let's call the lifetime of this reference `'1`
37 LL | match map.get() {
38 | --- immutable borrow occurs here
41 | - returning this value requires that `*map` is borrowed for `'1`
43 LL | map.set(String::new()); // Ideally, just AST would error here
44 | ^^^ mutable borrow occurs here
46 error: aborting due to 3 previous errors
48 For more information about this error, try `rustc --explain E0502`.