mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-27 18:56:24 +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.
25 lines
606 B
Rust
25 lines
606 B
Rust
// Regression test for issue #67007
|
|
// Ensures that we show information about the specific regions involved
|
|
|
|
// Covariant over 'a, invariant over 'tcx
|
|
struct FnCtxt<'a, 'tcx: 'a>(&'a (), *mut &'tcx ());
|
|
|
|
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|
fn use_it(&self, _: &'tcx ()) {}
|
|
}
|
|
|
|
struct Consumer<'tcx>(&'tcx ());
|
|
|
|
impl<'tcx> Consumer<'tcx> {
|
|
fn bad_method<'a>(&self, fcx: &FnCtxt<'a, 'tcx>) {
|
|
let other = self.use_fcx(fcx);
|
|
fcx.use_it(other); //~ ERROR lifetime may not live long enough
|
|
}
|
|
|
|
fn use_fcx<'a>(&self, _: &FnCtxt<'a, 'tcx>) -> &'a () {
|
|
&()
|
|
}
|
|
}
|
|
|
|
fn main() {}
|