Skip to content

Commit 72c235d

Browse files
committed
WIP patch test stderr
1 parent c990309 commit 72c235d

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed

src/test/ui/nll/get_default.nll.stderr

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as imm
44
LL | match map.get() {
55
| --- immutable borrow occurs here
66
...
7-
LL | map.set(String::new()); // Just AST errors here
7+
LL | map.set(String::new()); // Ideally, this would not error.
88
| ^^^ mutable borrow occurs here
99
...
1010
LL | }
1111
| - immutable borrow ends here
1212

1313
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
14-
--> $DIR/get_default.rs:44:17
14+
--> $DIR/get_default.rs:45:17
1515
|
1616
LL | match map.get() {
1717
| --- immutable borrow occurs here
@@ -23,29 +23,71 @@ LL | }
2323
| - immutable borrow ends here
2424

2525
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
26-
--> $DIR/get_default.rs:50:17
26+
--> $DIR/get_default.rs:51:17
2727
|
2828
LL | match map.get() {
2929
| --- immutable borrow occurs here
3030
...
31-
LL | map.set(String::new()); // Just AST errors here
31+
LL | map.set(String::new()); // Ideally, just AST would error here
3232
| ^^^ mutable borrow occurs here
3333
...
3434
LL | }
3535
| - immutable borrow ends here
3636

3737
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
38-
--> $DIR/get_default.rs:44:17
38+
--> $DIR/get_default.rs:33:17
39+
|
40+
LL | match map.get() {
41+
| --- immutable borrow occurs here
42+
...
43+
LL | map.set(String::new()); // Ideally, this would not error.
44+
| ^^^ mutable borrow occurs here
45+
|
46+
note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 26:1...
47+
--> $DIR/get_default.rs:26:1
48+
|
49+
LL | / fn ok(map: &mut Map) -> &String {
50+
LL | | loop {
51+
LL | | match map.get() {
52+
LL | | Some(v) => {
53+
... |
54+
LL | | }
55+
LL | | }
56+
| |_^
57+
58+
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
59+
--> $DIR/get_default.rs:51:17
60+
|
61+
LL | match map.get() {
62+
| --- immutable borrow occurs here
63+
...
64+
LL | map.set(String::new()); // Ideally, just AST would error here
65+
| ^^^ mutable borrow occurs here
66+
|
67+
note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 41:1...
68+
--> $DIR/get_default.rs:41:1
69+
|
70+
LL | / fn err(map: &mut Map) -> &String {
71+
LL | | loop {
72+
LL | | match map.get() {
73+
LL | | Some(v) => {
74+
... |
75+
LL | | }
76+
LL | | }
77+
| |_^
78+
79+
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
80+
--> $DIR/get_default.rs:45:17
3981
|
4082
LL | match map.get() {
4183
| --- immutable borrow occurs here
4284
LL | Some(v) => {
4385
LL | map.set(String::new()); // Both AST and MIR error here
44-
| ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
86+
| ^^^ mutable borrow occurs here
4587
...
4688
LL | return v;
4789
| - borrow later used here
4890

49-
error: aborting due to 4 previous errors
91+
error: aborting due to 6 previous errors
5092

5193
For more information about this error, try `rustc --explain E0502`.

0 commit comments

Comments
 (0)