rust/tests/ui/async-await/async-closures/without-precise-captures-we-are-powerless.stderr
2024-11-02 03:33:31 +00:00

144 lines
5.6 KiB
Plaintext

error[E0597]: `x` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:16: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:21: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
error[E0597]: `x` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:28: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:32: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:33: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
error[E0505]: cannot move out of `c` because it is borrowed
--> $DIR/without-precise-captures-we-are-powerless.rs:34: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
error[E0597]: `x` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:38: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:40:20
|
LL | fn through_field_and_ref<'a>(x: &S<'a>) {
| ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>`
...
LL | outlives::<'a>(call_once(c));
| ^^^^^^^^^^^^ lifetime `'a` required
error[E0597]: `c` does not live long enough
--> $DIR/without-precise-captures-we-are-powerless.rs:45: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
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/without-precise-captures-we-are-powerless.rs:46:20
|
LL | fn through_field_and_ref_move<'a>(x: &S<'a>) {
| ------ help: add explicit lifetime `'a` to the type of `x`: `&'a S<'a>`
...
LL | outlives::<'a>(call_once(c));
| ^^^^^^^^^^^^ lifetime `'a` required
error: aborting due to 10 previous errors
Some errors have detailed explanations: E0505, E0597, E0621.
For more information about an error, try `rustc --explain E0505`.