diff options
| author | Miguel Guarniz <mi9uel9@gmail.com> | 2022-04-06 19:04:15 -0400 |
|---|---|---|
| committer | Miguel Guarniz <mi9uel9@gmail.com> | 2022-04-08 11:59:59 -0400 |
| commit | 0baf85e8b6588ea24af710c981c91930e01f5a19 (patch) | |
| tree | dd8b7d16c9116b81bb9a977fddbaf5605782da99 /compiler/rustc_middle/src | |
| parent | b73b4de982a16e8819e804cb648ff3ea63d22028 (diff) | |
| download | rust-0baf85e8b6588ea24af710c981c91930e01f5a19.tar.gz rust-0baf85e8b6588ea24af710c981c91930e01f5a19.zip | |
remove some uses of visit_all_item_likes in incremental, metadata and interface crates
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/hir/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index fcce2d005d7..039e9953814 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs @@ -45,6 +45,21 @@ pub struct ModuleItems { foreign_items: Box<[ForeignItemId]>, } +impl ModuleItems { + pub fn items(&self) -> impl Iterator<Item = ItemId> { + self.items.to_vec().into_iter() + } + pub fn trait_items(&self) -> impl Iterator<Item = TraitItemId> { + self.trait_items.to_vec().into_iter() + } + pub fn impl_items(&self) -> impl Iterator<Item = ImplItemId> { + self.impl_items.to_vec().into_iter() + } + pub fn foreign_items(&self) -> impl Iterator<Item = ForeignItemId> { + self.foreign_items.to_vec().into_iter() + } +} + impl<'tcx> TyCtxt<'tcx> { #[inline(always)] pub fn hir(self) -> map::Map<'tcx> { |
