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
|
@ -8,7 +8,6 @@ use std::{io, iter, mem};
|
|||
pub(super) use cstore_impl::provide;
|
||||
use proc_macro::bridge::client::ProcMacro;
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::owned_slice::OwnedSlice;
|
||||
|
@ -963,14 +962,14 @@ impl CrateRoot {
|
|||
pub(crate) fn decode_crate_deps<'a>(
|
||||
&self,
|
||||
metadata: &'a MetadataBlob,
|
||||
) -> impl ExactSizeIterator<Item = CrateDep> + Captures<'a> {
|
||||
) -> impl ExactSizeIterator<Item = CrateDep> {
|
||||
self.crate_deps.decode(metadata)
|
||||
}
|
||||
|
||||
pub(crate) fn decode_target_modifiers<'a>(
|
||||
&self,
|
||||
metadata: &'a MetadataBlob,
|
||||
) -> impl ExactSizeIterator<Item = TargetModifier> + Captures<'a> {
|
||||
) -> impl ExactSizeIterator<Item = TargetModifier> {
|
||||
self.target_modifiers.decode(metadata)
|
||||
}
|
||||
}
|
||||
|
@ -1276,7 +1275,7 @@ impl<'a> CrateMetadataRef<'a> {
|
|||
self,
|
||||
id: DefIndex,
|
||||
sess: &'a Session,
|
||||
) -> impl Iterator<Item = ModChild> + 'a {
|
||||
) -> impl Iterator<Item = ModChild> {
|
||||
iter::from_coroutine(
|
||||
#[coroutine]
|
||||
move || {
|
||||
|
@ -1326,10 +1325,7 @@ impl<'a> CrateMetadataRef<'a> {
|
|||
.is_some_and(|ident| ident.name == kw::SelfLower)
|
||||
}
|
||||
|
||||
fn get_associated_item_or_field_def_ids(
|
||||
self,
|
||||
id: DefIndex,
|
||||
) -> impl Iterator<Item = DefId> + 'a {
|
||||
fn get_associated_item_or_field_def_ids(self, id: DefIndex) -> impl Iterator<Item = DefId> {
|
||||
self.root
|
||||
.tables
|
||||
.associated_item_or_field_def_ids
|
||||
|
@ -1380,7 +1376,7 @@ impl<'a> CrateMetadataRef<'a> {
|
|||
self,
|
||||
id: DefIndex,
|
||||
sess: &'a Session,
|
||||
) -> impl Iterator<Item = hir::Attribute> + 'a {
|
||||
) -> impl Iterator<Item = hir::Attribute> {
|
||||
self.root
|
||||
.tables
|
||||
.attributes
|
||||
|
@ -1417,12 +1413,12 @@ impl<'a> CrateMetadataRef<'a> {
|
|||
}
|
||||
|
||||
/// Decodes all traits in the crate (for rustdoc and rustc diagnostics).
|
||||
fn get_traits(self) -> impl Iterator<Item = DefId> + 'a {
|
||||
fn get_traits(self) -> impl Iterator<Item = DefId> {
|
||||
self.root.traits.decode(self).map(move |index| self.local_def_id(index))
|
||||
}
|
||||
|
||||
/// Decodes all trait impls in the crate (for rustdoc).
|
||||
fn get_trait_impls(self) -> impl Iterator<Item = DefId> + 'a {
|
||||
fn get_trait_impls(self) -> impl Iterator<Item = DefId> {
|
||||
self.cdata.trait_impls.values().flat_map(move |impls| {
|
||||
impls.decode(self).map(move |(impl_index, _)| self.local_def_id(impl_index))
|
||||
})
|
||||
|
@ -1463,7 +1459,7 @@ impl<'a> CrateMetadataRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_native_libraries(self, sess: &'a Session) -> impl Iterator<Item = NativeLib> + 'a {
|
||||
fn get_native_libraries(self, sess: &'a Session) -> impl Iterator<Item = NativeLib> {
|
||||
self.root.native_libraries.decode((self, sess))
|
||||
}
|
||||
|
||||
|
@ -1476,7 +1472,7 @@ impl<'a> CrateMetadataRef<'a> {
|
|||
.decode((self, sess))
|
||||
}
|
||||
|
||||
fn get_foreign_modules(self, sess: &'a Session) -> impl Iterator<Item = ForeignModule> + 'a {
|
||||
fn get_foreign_modules(self, sess: &'a Session) -> impl Iterator<Item = ForeignModule> {
|
||||
self.root.foreign_modules.decode((self, sess))
|
||||
}
|
||||
|
||||
|
@ -1816,7 +1812,7 @@ impl<'a> CrateMetadataRef<'a> {
|
|||
.decode(self)
|
||||
}
|
||||
|
||||
fn get_doc_link_traits_in_scope(self, index: DefIndex) -> impl Iterator<Item = DefId> + 'a {
|
||||
fn get_doc_link_traits_in_scope(self, index: DefIndex) -> impl Iterator<Item = DefId> {
|
||||
self.root
|
||||
.tables
|
||||
.doc_link_traits_in_scope
|
||||
|
@ -1887,7 +1883,7 @@ impl CrateMetadata {
|
|||
cdata
|
||||
}
|
||||
|
||||
pub(crate) fn dependencies(&self) -> impl Iterator<Item = CrateNum> + '_ {
|
||||
pub(crate) fn dependencies(&self) -> impl Iterator<Item = CrateNum> {
|
||||
self.dependencies.iter().copied()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue