Rollup merge of #121344 - fmease:lta-constr-by-input, r=oli-obk

Expand weak alias types before collecting constrained/referenced late bound regions + refactorings

Fixes #114220.
Follow-up to #120780.

r? `@oli-obk`
This commit is contained in:
Matthias Krüger 2024-02-20 19:35:41 +01:00 committed by GitHub
commit 532b3eacb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 300 additions and 173 deletions

View file

@ -5,7 +5,7 @@ use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use crate::infer::TyCtxt;
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_middle::ty::{self, Binder, Region, Ty, TypeVisitable};
use rustc_middle::ty::{self, Binder, Region, Ty, TypeFoldable};
use rustc_span::Span;
/// Information about the anonymous region we are searching for.
@ -142,10 +142,10 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
fn includes_region(
&self,
ty: Binder<'tcx, impl TypeVisitable<TyCtxt<'tcx>>>,
ty: Binder<'tcx, impl TypeFoldable<TyCtxt<'tcx>>>,
region: ty::BoundRegionKind,
) -> bool {
let late_bound_regions = self.tcx().collect_referenced_late_bound_regions(&ty);
let late_bound_regions = self.tcx().collect_referenced_late_bound_regions(ty);
// We are only checking is any region meets the condition so order doesn't matter
#[allow(rustc::potential_query_instability)]
late_bound_regions.iter().any(|r| *r == region)