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.
19 lines
840 B
Plaintext
19 lines
840 B
Plaintext
error: lifetime may not live long enough
|
|
--> $DIR/issue-67007-escaping-data.rs:16:9
|
|
|
|
|
LL | impl<'tcx> Consumer<'tcx> {
|
|
| ---- lifetime `'tcx` defined here
|
|
LL | fn bad_method<'a>(&self, fcx: &FnCtxt<'a, 'tcx>) {
|
|
| -- lifetime `'a` defined here
|
|
LL | let other = self.use_fcx(fcx);
|
|
LL | fcx.use_it(other);
|
|
| ^^^^^^^^^^^^^^^^^ argument requires that `'a` must outlive `'tcx`
|
|
|
|
|
= help: consider adding the following bound: `'a: 'tcx`
|
|
= note: requirement occurs because of the type `FnCtxt<'_, '_>`, which makes the generic argument `'_` invariant
|
|
= note: the struct `FnCtxt<'a, 'tcx>` is invariant over the parameter `'tcx`
|
|
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
|
|
|
error: aborting due to 1 previous error
|
|
|