Skip to content

Commit

Permalink
add some comments to hir::ModuleItems
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Mar 21, 2024
1 parent df8ac8f commit 1e926b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_middle/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ pub struct ModuleItems {
}

impl ModuleItems {
/// Returns all non-associated locally defined items in all modules.
///
/// Note that this does *not* include associated items of `impl` blocks! It also does not
/// include foreign items. If you want to e.g. get all functions, use `definitions()` below.
pub fn items(&self) -> impl Iterator<Item = ItemId> + '_ {
self.items.iter().copied()
}
Expand All @@ -38,6 +42,8 @@ impl ModuleItems {
self.trait_items.iter().copied()
}

/// Returns all items that are associated with some `impl` block (both inherent and trait impl
/// blocks).
pub fn impl_items(&self) -> impl Iterator<Item = ImplItemId> + '_ {
self.impl_items.iter().copied()
}
Expand Down

0 comments on commit 1e926b5

Please sign in to comment.