File tree 6 files changed +43
-44
lines changed
6 files changed +43
-44
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,9 @@ error[E0597]: borrowed value does not live long enough
2
2
--> $DIR/issue-47184.rs:14:44
3
3
|
4
4
LL | let _vec: Vec<&'static String> = vec![&String::new()];
5
- | ^^^^^^^^^^^^^ temporary value does not live long enough
6
- LL | //~^ ERROR borrowed value does not live long enough [E0597]
7
- LL | }
8
- | - temporary value only lives until here
5
+ | ^^^^^^^^^^^^^ - temporary value only lives until here
6
+ | |
7
+ | temporary value does not live long enough
9
8
|
10
9
= note: borrowed value must be valid for the static lifetime...
11
10
Original file line number Diff line number Diff line change @@ -55,6 +55,18 @@ LL | | }
55
55
LL | | }
56
56
| |_^
57
57
58
+ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
59
+ --> $DIR/get_default.rs:45:17
60
+ |
61
+ LL | match map.get() {
62
+ | --- immutable borrow occurs here
63
+ LL | Some(v) => {
64
+ LL | map.set(String::new()); // Both AST and MIR error here
65
+ | ^^^ mutable borrow occurs here
66
+ ...
67
+ LL | return v;
68
+ | - borrow later used here
69
+
58
70
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
59
71
--> $DIR/get_default.rs:51:17
60
72
|
@@ -76,18 +88,6 @@ LL | | }
76
88
LL | | }
77
89
| |_^
78
90
79
- error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
80
- --> $DIR/get_default.rs:45:17
81
- |
82
- LL | match map.get() {
83
- | --- immutable borrow occurs here
84
- LL | Some(v) => {
85
- LL | map.set(String::new()); // Both AST and MIR error here
86
- | ^^^ mutable borrow occurs here
87
- ...
88
- LL | return v;
89
- | - borrow later used here
90
-
91
91
error: aborting due to 6 previous errors
92
92
93
93
For more information about this error, try `rustc --explain E0502`.
Original file line number Diff line number Diff line change 1
- error[E0597]: `b1 ` does not live long enough
2
- --> $DIR/dropck_arr_cycle_checked.rs:111 :24
1
+ error[E0597]: `b3 ` does not live long enough
2
+ --> $DIR/dropck_arr_cycle_checked.rs:105 :24
3
3
|
4
- LL | b3 .a[0 ].v.set(Some(&b1 ));
4
+ LL | b1 .a[1 ].v.set(Some(&b3 ));
5
5
| ^^^ borrowed value does not live long enough
6
6
...
7
7
LL | }
@@ -22,10 +22,10 @@ LL | }
22
22
| borrowed value only lives until here
23
23
| borrow later used here, when `b1` is dropped
24
24
25
- error[E0597]: `b3 ` does not live long enough
26
- --> $DIR/dropck_arr_cycle_checked.rs:105 :24
25
+ error[E0597]: `b1 ` does not live long enough
26
+ --> $DIR/dropck_arr_cycle_checked.rs:111 :24
27
27
|
28
- LL | b1 .a[1 ].v.set(Some(&b3 ));
28
+ LL | b3 .a[0 ].v.set(Some(&b1 ));
29
29
| ^^^ borrowed value does not live long enough
30
30
...
31
31
LL | }
Original file line number Diff line number Diff line change 1
- error[E0597]: `d1 ` does not live long enough
2
- --> $DIR/dropck_direct_cycle_with_drop.rs:48 :19
1
+ error[E0597]: `d2 ` does not live long enough
2
+ --> $DIR/dropck_direct_cycle_with_drop.rs:46 :19
3
3
|
4
- LL | d2 .p.set(Some(&d1 ));
4
+ LL | d1 .p.set(Some(&d2 ));
5
5
| ^^^ borrowed value does not live long enough
6
- LL | //~^ ERROR `d1` does not live long enough
6
+ ...
7
7
LL | }
8
8
| -
9
9
| |
@@ -12,12 +12,12 @@ LL | }
12
12
|
13
13
= note: values in a scope are dropped in the opposite order they are defined
14
14
15
- error[E0597]: `d2 ` does not live long enough
16
- --> $DIR/dropck_direct_cycle_with_drop.rs:46 :19
15
+ error[E0597]: `d1 ` does not live long enough
16
+ --> $DIR/dropck_direct_cycle_with_drop.rs:48 :19
17
17
|
18
- LL | d1 .p.set(Some(&d2 ));
18
+ LL | d2 .p.set(Some(&d1 ));
19
19
| ^^^ borrowed value does not live long enough
20
- ...
20
+ LL | //~^ ERROR `d1` does not live long enough
21
21
LL | }
22
22
| -
23
23
| |
Original file line number Diff line number Diff line change 1
- error[E0597]: `c1 ` does not live long enough
2
- --> $DIR/dropck_vec_cycle_checked.rs:121 :24
1
+ error[E0597]: `c3 ` does not live long enough
2
+ --> $DIR/dropck_vec_cycle_checked.rs:115 :24
3
3
|
4
- LL | c3 .v[0 ].v.set(Some(&c1 ));
4
+ LL | c1 .v[1 ].v.set(Some(&c3 ));
5
5
| ^^^ borrowed value does not live long enough
6
6
...
7
7
LL | }
@@ -22,10 +22,10 @@ LL | }
22
22
| borrowed value only lives until here
23
23
| borrow later used here, when `c1` is dropped
24
24
25
- error[E0597]: `c3 ` does not live long enough
26
- --> $DIR/dropck_vec_cycle_checked.rs:115 :24
25
+ error[E0597]: `c1 ` does not live long enough
26
+ --> $DIR/dropck_vec_cycle_checked.rs:121 :24
27
27
|
28
- LL | c1 .v[1 ].v.set(Some(&c3 ));
28
+ LL | c3 .v[0 ].v.set(Some(&c1 ));
29
29
| ^^^ borrowed value does not live long enough
30
30
...
31
31
LL | }
Original file line number Diff line number Diff line change 1
- error[E0597]: `c1 ` does not live long enough
2
- --> $DIR/vec-must-not-hide-type-from-dropck.rs:129 :24
1
+ error[E0597]: `c2 ` does not live long enough
2
+ --> $DIR/vec-must-not-hide-type-from-dropck.rs:127 :24
3
3
|
4
- LL | c2 .v[0].v.set(Some(&c1 ));
4
+ LL | c1 .v[0].v.set(Some(&c2 ));
5
5
| ^^^ borrowed value does not live long enough
6
- LL | //~^ ERROR `c1` does not live long enough
6
+ ...
7
7
LL | }
8
8
| -
9
9
| |
10
10
| borrowed value only lives until here
11
11
| borrow later used here, when `c1` is dropped
12
12
13
- error[E0597]: `c2 ` does not live long enough
14
- --> $DIR/vec-must-not-hide-type-from-dropck.rs:127 :24
13
+ error[E0597]: `c1 ` does not live long enough
14
+ --> $DIR/vec-must-not-hide-type-from-dropck.rs:129 :24
15
15
|
16
- LL | c1 .v[0].v.set(Some(&c2 ));
16
+ LL | c2 .v[0].v.set(Some(&c1 ));
17
17
| ^^^ borrowed value does not live long enough
18
- ...
18
+ LL | //~^ ERROR `c1` does not live long enough
19
19
LL | }
20
20
| -
21
21
| |
You can’t perform that action at this time.
0 commit comments