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:
commit
7f14d2eba4
84 changed files with 223 additions and 294 deletions
|
@ -20,7 +20,6 @@ use std::ops::Bound;
|
|||
|
||||
use rustc_abi::ExternAbi;
|
||||
use rustc_ast::Recovered;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_errors::{
|
||||
|
@ -1690,10 +1689,10 @@ fn polarity_of_impl(
|
|||
/// the lifetimes that are declared. For fns or methods, we have to
|
||||
/// screen out those that do not appear in any where-clauses etc using
|
||||
/// `resolve_lifetime::early_bound_lifetimes`.
|
||||
fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>(
|
||||
fn early_bound_lifetimes_from_generics<'a, 'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
generics: &'a hir::Generics<'a>,
|
||||
) -> impl Iterator<Item = &'a hir::GenericParam<'a>> + Captures<'tcx> {
|
||||
) -> impl Iterator<Item = &'a hir::GenericParam<'a>> {
|
||||
generics.params.iter().filter(move |param| match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => !tcx.is_late_bound(param.hir_id),
|
||||
_ => false,
|
||||
|
|
|
@ -160,7 +160,7 @@ enum Scope<'a> {
|
|||
|
||||
impl<'a> Scope<'a> {
|
||||
// A helper for debugging scopes without printing parent scopes
|
||||
fn debug_truncated(&'a self) -> impl fmt::Debug + 'a {
|
||||
fn debug_truncated(&self) -> impl fmt::Debug {
|
||||
fmt::from_fn(move |f| match self {
|
||||
Self::Binder { bound_vars, scope_type, hir_id, where_bound_origin, s: _ } => f
|
||||
.debug_struct("Binder")
|
||||
|
@ -2159,10 +2159,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
|
|||
|
||||
/// Walk the generics of the item for a trait bound whose self type
|
||||
/// corresponds to the expected res, and return the trait def id.
|
||||
fn for_each_trait_bound_on_res(
|
||||
&self,
|
||||
expected_res: Res,
|
||||
) -> impl Iterator<Item = DefId> + use<'tcx, '_> {
|
||||
fn for_each_trait_bound_on_res(&self, expected_res: Res) -> impl Iterator<Item = DefId> {
|
||||
std::iter::from_coroutine(
|
||||
#[coroutine]
|
||||
move || {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue