1
Fork 0

Rollup merge of #137334 - compiler-errors:edition-2024-fresh-2, r=saethlin,traviscross

Greatly simplify lifetime captures in edition 2024

Remove most of the `+ Captures` and `+ '_` from the compiler, since they are now unnecessary with the new edition 2021 lifetime capture rules. Use some `+ 'tcx` and `+ 'static` rather than being overly verbose with precise capturing syntax.
This commit is contained in:
Jacob Pratt 2025-02-23 02:44:18 -05:00 committed by GitHub
commit 7f14d2eba4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
84 changed files with 223 additions and 294 deletions

View file

@ -216,11 +216,11 @@ fn to_upvars_resolved_place_builder<'tcx>(
/// Supports only HIR projection kinds that represent a path that might be
/// captured by a closure or a coroutine, i.e., an `Index` or a `Subslice`
/// projection kinds are unsupported.
fn strip_prefix<'a, 'tcx>(
fn strip_prefix<'tcx>(
mut base_ty: Ty<'tcx>,
projections: &'a [PlaceElem<'tcx>],
projections: &[PlaceElem<'tcx>],
prefix_projections: &[HirProjection<'tcx>],
) -> impl Iterator<Item = PlaceElem<'tcx>> + 'a {
) -> impl Iterator<Item = PlaceElem<'tcx>> {
let mut iter = projections
.iter()
.copied()

View file

@ -165,12 +165,12 @@ impl<'tcx> ThirBuildCx<'tcx> {
})
}
fn explicit_params<'a>(
&'a mut self,
fn explicit_params(
&mut self,
owner_id: HirId,
fn_decl: &'tcx hir::FnDecl<'tcx>,
body: &'tcx hir::Body<'tcx>,
) -> impl Iterator<Item = Param<'tcx>> + 'a {
) -> impl Iterator<Item = Param<'tcx>> {
let fn_sig = self.typeck_results.liberated_fn_sigs()[owner_id];
body.params.iter().enumerate().map(move |(index, param)| {