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
663 B
Plaintext
16 lines
663 B
Plaintext
error: lifetime may not live long enough
|
|
--> $DIR/region-invariant-static-error-reporting.rs:16:9
|
|
|
|
|
LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
|
|
| -- lifetime `'a` defined here
|
|
...
|
|
LL | mk_static()
|
|
| ^^^^^^^^^^^ assignment requires that `'a` must outlive `'static`
|
|
|
|
|
= note: requirement occurs because of the type `Invariant<'_>`, which makes the generic argument `'_` invariant
|
|
= note: the struct `Invariant<'a>` is invariant over the parameter `'a`
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
error: aborting due to 1 previous error
|
|
|