rust/tests/ui/inline-const/const-expr-lifetime-err.stderr
dianne ac922245f0 best_blame_constraint: don't filter constraints by sup SCC
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.
2025-01-06 16:08:29 -08:00

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`.