@@ -29,22 +29,6 @@ LL | outlives::<'a>(call_once(c));
29
29
LL | }
30
30
| - `c` dropped here while still borrowed
31
31
32
- error[E0505]: cannot move out of `c` because it is borrowed
33
- --> $DIR/without-precise-captures-we-are-powerless.rs:22:30
34
- |
35
- LL | fn simple<'a>(x: &'a i32) {
36
- | -- lifetime `'a` defined here
37
- ...
38
- LL | let c = async move || { println!("{}", *x); };
39
- | - binding `c` declared here
40
- LL | outlives::<'a>(c());
41
- | ---
42
- | |
43
- | borrow of `c` occurs here
44
- | argument requires that `c` is borrowed for `'a`
45
- LL | outlives::<'a>(call_once(c));
46
- | ^ move out of `c` occurs here
47
-
48
32
error[E0597]: `x` does not live long enough
49
33
--> $DIR/without-precise-captures-we-are-powerless.rs:28:13
50
34
|
@@ -72,6 +56,11 @@ LL | outlives::<'a>(call_once(c));
72
56
LL |
73
57
LL | let c = async move || { println!("{}", *x.0); };
74
58
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ move out of `x` occurs here
59
+ |
60
+ help: consider cloning the value if the performance cost is acceptable
61
+ |
62
+ LL | let c = async || { println!("{}", *x.0); }.clone();
63
+ | ++++++++
75
64
76
65
error[E0597]: `c` does not live long enough
77
66
--> $DIR/without-precise-captures-we-are-powerless.rs:33:20
@@ -146,7 +135,7 @@ LL | // outlives::<'a>(call_once(c)); // FIXME(async_closures): Figure out w
146
135
LL | }
147
136
| - `c` dropped here while still borrowed
148
137
149
- error: aborting due to 10 previous errors
138
+ error: aborting due to 9 previous errors
150
139
151
140
Some errors have detailed explanations: E0505, E0597, E0621.
152
141
For more information about an error, try `rustc --explain E0505`.
0 commit comments