diff options
| author | Michael Goulet <michael@errs.io> | 2025-02-20 18:58:46 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-02-22 22:24:52 +0000 |
| commit | 12e3911d81034864314503b9c2d9fba2773c7904 (patch) | |
| tree | 3c137d293516116a798effc67b2077dbb2025941 /compiler/rustc_metadata | |
| parent | 46420c96070b4c4bd8242f16d5806b8f26a57016 (diff) | |
Greatly simplify lifetime captures in edition 2024
Diffstat (limited to 'compiler/rustc_metadata')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder.rs | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index e8dcda875e6..0604892e34d 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -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() } |
