1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
error[E0597]: `x` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:14:13
|
LL | fn simple<'a>(x: &'a i32) {
| -- lifetime `'a` defined here
LL | let c = async || { println!("{}", *x); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
LL | outlives::<'a>(c());
LL | outlives::<'a>(call_once(c));
| ---------------------------- argument requires that `x` is borrowed for `'a`
...
LL | }
| - `x` dropped here while still borrowed
error[E0597]: `c` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:19:20
|
LL | fn simple<'a>(x: &'a i32) {
| -- lifetime `'a` defined here
...
LL | let c = async move || { println!("{}", *x); };
| - binding `c` declared here
LL | outlives::<'a>(c());
| ---------------^---
| | |
| | borrowed value does not live long enough
| argument requires that `c` is borrowed for `'a`
LL | outlives::<'a>(call_once(c));
LL | }
| - `c` dropped here while still borrowed
|
note: requirement that the value outlives `'a` introduced here
--> $DIR/without-precise-captures-we-are-powerless.rs:7:33
|
LL | fn outlives<'a>(_: impl Sized + 'a) {}
| ^^
error[E0597]: `x` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:26:13
|
LL | fn through_field<'a>(x: S<'a>) {
| -- lifetime `'a` defined here
LL | let c = async || { println!("{}", *x.0); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
LL | outlives::<'a>(c());
LL | outlives::<'a>(call_once(c));
| ---------------------------- argument requires that `x` is borrowed for `'a`
...
LL | }
| - `x` dropped here while still borrowed
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/without-precise-captures-we-are-powerless.rs:30:13
|
LL | fn through_field<'a>(x: S<'a>) {
| -- lifetime `'a` defined here
LL | let c = async || { println!("{}", *x.0); };
| ---------------------------------- borrow of `x` occurs here
LL | outlives::<'a>(c());
LL | outlives::<'a>(call_once(c));
| ---------------------------- argument requires that `x` is borrowed for `'a`
LL |
LL | let c = async move || { println!("{}", *x.0); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move out of `x` occurs here
error[E0597]: `c` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:31:20
|
LL | fn through_field<'a>(x: S<'a>) {
| -- lifetime `'a` defined here
...
LL | let c = async move || { println!("{}", *x.0); };
| - binding `c` declared here
LL | outlives::<'a>(c());
| ---------------^---
| | |
| | borrowed value does not live long enough
| argument requires that `c` is borrowed for `'a`
LL | outlives::<'a>(call_once(c));
LL | }
| - `c` dropped here while still borrowed
|
note: requirement that the value outlives `'a` introduced here
--> $DIR/without-precise-captures-we-are-powerless.rs:7:33
|
LL | fn outlives<'a>(_: impl Sized + 'a) {}
| ^^
error[E0505]: cannot move out of `c` because it is borrowed
--> $DIR/without-precise-captures-we-are-powerless.rs:32:30
|
LL | fn through_field<'a>(x: S<'a>) {
| -- lifetime `'a` defined here
...
LL | let c = async move || { println!("{}", *x.0); };
| - binding `c` declared here
LL | outlives::<'a>(c());
| -------------------
| | |
| | borrow of `c` occurs here
| argument requires that `c` is borrowed for `'a`
LL | outlives::<'a>(call_once(c));
| ^ move out of `c` occurs here
|
note: requirement that the value outlives `'a` introduced here
--> $DIR/without-precise-captures-we-are-powerless.rs:7:33
|
LL | fn outlives<'a>(_: impl Sized + 'a) {}
| ^^
error[E0597]: `x` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:36:13
|
LL | fn through_field_and_ref<'a>(x: &S<'a>) {
| -- lifetime `'a` defined here
LL | let c = async || { println!("{}", *x.0); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
LL | outlives::<'a>(c());
LL | outlives::<'a>(call_once(c));
| ---------------------------- argument requires that `x` is borrowed for `'a`
LL | }
| - `x` dropped here while still borrowed
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/without-precise-captures-we-are-powerless.rs:38:5
|
LL | outlives::<'a>(call_once(c));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
|
help: add explicit lifetime `'a` to the type of `x`
|
LL | fn through_field_and_ref<'a>(x: &'a S<'a>) {
| ++
error[E0597]: `c` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:43:20
|
LL | fn through_field_and_ref_move<'a>(x: &S<'a>) {
| -- lifetime `'a` defined here
LL | let c = async move || { println!("{}", *x.0); };
| - binding `c` declared here
LL | outlives::<'a>(c());
| ---------------^---
| | |
| | borrowed value does not live long enough
| argument requires that `c` is borrowed for `'a`
LL | outlives::<'a>(call_once(c));
LL | }
| - `c` dropped here while still borrowed
|
note: requirement that the value outlives `'a` introduced here
--> $DIR/without-precise-captures-we-are-powerless.rs:7:33
|
LL | fn outlives<'a>(_: impl Sized + 'a) {}
| ^^
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/without-precise-captures-we-are-powerless.rs:44:5
|
LL | outlives::<'a>(call_once(c));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
|
help: add explicit lifetime `'a` to the type of `x`
|
LL | fn through_field_and_ref_move<'a>(x: &'a S<'a>) {
| ++
error[E0597]: `x` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:52:13
|
LL | fn through_method<'a>(x: &'a i32) {
| -- lifetime `'a` defined here
LL | let c = async || { println!("{}", *x); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
LL | T.outlives::<'a>(c());
LL | T.outlives::<'a>(call_once(c));
| ------------------------------ argument requires that `x` is borrowed for `'a`
...
LL | }
| - `x` dropped here while still borrowed
error[E0597]: `c` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:57:22
|
LL | fn through_method<'a>(x: &'a i32) {
| -- lifetime `'a` defined here
...
LL | let c = async move || { println!("{}", *x); };
| - binding `c` declared here
LL | T.outlives::<'a>(c());
| -----------------^---
| | |
| | borrowed value does not live long enough
| argument requires that `c` is borrowed for `'a`
LL | T.outlives::<'a>(call_once(c));
LL | }
| - `c` dropped here while still borrowed
|
note: requirement that the value outlives `'a` introduced here
--> $DIR/without-precise-captures-we-are-powerless.rs:49:47
|
LL | fn outlives<'a>(&'a self, _: impl Sized + 'a) {}
| ^^
error: aborting due to 12 previous errors
Some errors have detailed explanations: E0505, E0597, E0621.
For more information about an error, try `rustc --explain E0505`.
|