mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-30 03: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.
19 lines
711 B
Plaintext
19 lines
711 B
Plaintext
error[E0597]: `y` does not live long enough
|
|
--> $DIR/const-expr-lifetime-err.rs:20:30
|
|
|
|
|
LL | fn foo<'a>() {
|
|
| -- lifetime `'a` defined here
|
|
LL | let y = ();
|
|
| - binding `y` declared here
|
|
LL | equate(InvariantRef::new(&y), const { InvariantRef::<'a>::NEW });
|
|
| ^^ ----------------------- using this value as a constant requires that `y` is borrowed for `'a`
|
|
| |
|
|
| borrowed value does not live long enough
|
|
LL |
|
|
LL | }
|
|
| - `y` dropped here while still borrowed
|
|
|
|
error: aborting due to 1 previous error
|
|
|
|
For more information about this error, try `rustc --explain E0597`.
|