mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00

The SCCs of the region graph are not a reliable heuristic to use for blaming an interesting constraint for diagnostics. For region errors, if the outlived region is `'static`, or the involved types are invariant in their lifetiems, there will be cycles in the constraint graph containing both the target region and the most interesting constraints to blame. To get better diagnostics in these cases, this commit removes that heuristic.
144 lines
5.6 KiB
Plaintext
144 lines
5.6 KiB
Plaintext
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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 | 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: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
|
|
|
|
error[E0621]: explicit lifetime required in the type of `x`
|
|
--> $DIR/without-precise-captures-we-are-powerless.rs:44:5
|
|
|
|
|
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`.
|