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.
16 lines
697 B
Plaintext
16 lines
697 B
Plaintext
error[E0597]: `person` does not live long enough
|
|
--> $DIR/coercion-generic-regions.rs:17:24
|
|
|
|
|
LL | let person = "Fred".to_string();
|
|
| ------ binding `person` declared here
|
|
LL | let person: &str = &person;
|
|
| ^^^^^^^ borrowed value does not live long enough
|
|
LL | let s: Box<dyn Trait<&'static str>> = Box::new(Struct { person: person });
|
|
| ------ this usage requires that `person` is borrowed for `'static`
|
|
LL | }
|
|
| - `person` dropped here while still borrowed
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0597`.
|