Rollup merge of #114301 - compiler-errors:dont-error-on-missing-region-outlives, r=spastorino
Don't check unnecessarily that impl trait is RPIT We have this random `return_type_impl_trait` function to detect if a function returns an RPIT which is used in outlives suggestions, but removing it doesn't actually change any diagnostics. Let's just remove it. Also, suppress a spurious outlives error from a ReError. Fixes #114274
This commit is contained in:
commit
f338a1f7ee
6 changed files with 46 additions and 35 deletions
|
@ -555,8 +555,8 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
|
|||
for (region_a, region_a_idx) in ®ions {
|
||||
// Ignore `'static` lifetimes for the purpose of this lint: it's
|
||||
// because we know it outlives everything and so doesn't give meaningful
|
||||
// clues
|
||||
if let ty::ReStatic = **region_a {
|
||||
// clues. Also ignore `ReError`, to avoid knock-down errors.
|
||||
if let ty::ReStatic | ty::ReError(_) = **region_a {
|
||||
continue;
|
||||
}
|
||||
// For each region argument (e.g., `'a` in our example), check for a
|
||||
|
@ -599,8 +599,9 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
|
|||
// on the GAT itself.
|
||||
for (region_b, region_b_idx) in ®ions {
|
||||
// Again, skip `'static` because it outlives everything. Also, we trivially
|
||||
// know that a region outlives itself.
|
||||
if ty::ReStatic == **region_b || region_a == region_b {
|
||||
// know that a region outlives itself. Also ignore `ReError`, to avoid
|
||||
// knock-down errors.
|
||||
if matches!(**region_b, ty::ReStatic | ty::ReError(_)) || region_a == region_b {
|
||||
continue;
|
||||
}
|
||||
if region_known_to_outlive(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue