1
Fork 0

Greatly simplify lifetime captures in edition 2024

This commit is contained in:
Michael Goulet 2025-02-20 18:58:46 +00:00
parent 46420c9607
commit 12e3911d81
84 changed files with 223 additions and 294 deletions

View file

@ -1074,7 +1074,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
&self,
path: &'tcx hir::Path<'tcx>,
args: GenericArgsRef<'tcx>,
) -> impl Iterator<Item = InsertableGenericArgs<'tcx>> + 'a {
) -> impl Iterator<Item = InsertableGenericArgs<'tcx>> + 'tcx {
let tcx = self.tecx.tcx;
let have_turbofish = path.segments.iter().any(|segment| {
segment.args.is_some_and(|args| args.args.iter().any(|arg| arg.is_ty_or_const()))

View file

@ -67,9 +67,7 @@ impl<'tcx> ObligationStorage<'tcx> {
obligations
}
fn unstalled_for_select(
&mut self,
) -> impl Iterator<Item = PredicateObligation<'tcx>> + use<'tcx> {
fn unstalled_for_select(&mut self) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'tcx {
mem::take(&mut self.pending).into_iter()
}

View file

@ -1,6 +1,5 @@
use std::marker::PhantomData;
use rustc_data_structures::captures::Captures;
use rustc_data_structures::obligation_forest::{
Error, ForestObligation, ObligationForest, ObligationProcessor, Outcome, ProcessResult,
};
@ -900,10 +899,10 @@ impl<'a, 'tcx> FulfillProcessor<'a, 'tcx> {
}
/// Returns the set of inference variables contained in `args`.
fn args_infer_vars<'a, 'tcx>(
selcx: &SelectionContext<'a, 'tcx>,
fn args_infer_vars<'tcx>(
selcx: &SelectionContext<'_, 'tcx>,
args: ty::Binder<'tcx, GenericArgsRef<'tcx>>,
) -> impl Iterator<Item = TyOrConstInferVar> + Captures<'tcx> {
) -> impl Iterator<Item = TyOrConstInferVar> {
selcx
.infcx
.resolve_vars_if_possible(args)

View file

@ -200,15 +200,12 @@ impl<'tcx> Children {
}
}
fn iter_children(children: &Children) -> impl Iterator<Item = DefId> + '_ {
fn iter_children(children: &Children) -> impl Iterator<Item = DefId> {
let nonblanket = children.non_blanket_impls.iter().flat_map(|(_, v)| v.iter());
children.blanket_impls.iter().chain(nonblanket).cloned()
}
fn filtered_children(
children: &mut Children,
st: SimplifiedType,
) -> impl Iterator<Item = DefId> + '_ {
fn filtered_children(children: &mut Children, st: SimplifiedType) -> impl Iterator<Item = DefId> {
let nonblanket = children.non_blanket_impls.entry(st).or_default().iter();
children.blanket_impls.iter().chain(nonblanket).cloned()
}

View file

@ -196,7 +196,7 @@ fn own_existential_vtable_entries(tcx: TyCtxt<'_>, trait_def_id: DefId) -> &[Def
fn own_existential_vtable_entries_iter(
tcx: TyCtxt<'_>,
trait_def_id: DefId,
) -> impl Iterator<Item = DefId> + '_ {
) -> impl Iterator<Item = DefId> {
let trait_methods = tcx
.associated_items(trait_def_id)
.in_definition_order()