11error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
2- --> $DIR/get_default.rs:21 :17
2+ --> $DIR/get_default.rs:24 :17
33 |
44LL | fn ok(map: &mut Map) -> &String {
55 | - let's call the lifetime of this reference `'1`
@@ -14,22 +14,22 @@ LL | map.set(String::new()); // Ideally, this would not error.
1414 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
1515
1616error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
17- --> $DIR/get_default.rs:32 :17
17+ --> $DIR/get_default.rs:35 :17
1818 |
1919LL | fn err(map: &mut Map) -> &String {
2020 | - let's call the lifetime of this reference `'1`
2121LL | loop {
2222LL | match map.get() {
2323 | --- immutable borrow occurs here
2424LL | Some(v) => {
25- LL | map.set(String::new()); // Both AST and MIR error here
25+ LL | map.set(String::new()); // We always expect an error here.
2626 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
2727LL |
2828LL | return v;
2929 | - returning this value requires that `*map` is borrowed for `'1`
3030
3131error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable
32- --> $DIR/get_default.rs:37 :17
32+ --> $DIR/get_default.rs:40 :17
3333 |
3434LL | fn err(map: &mut Map) -> &String {
3535 | - let's call the lifetime of this reference `'1`
@@ -40,7 +40,7 @@ LL | match map.get() {
4040LL | return v;
4141 | - returning this value requires that `*map` is borrowed for `'1`
4242...
43- LL | map.set(String::new()); // Ideally, just AST would error here
43+ LL | map.set(String::new()); // Ideally, this would not error.
4444 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
4545
4646error: aborting due to 3 previous errors
0 commit comments