Skip to content

Commit 1e926b5

Browse files
committed
add some comments to hir::ModuleItems
1 parent df8ac8f commit 1e926b5

File tree

1 file changed

+6
-0
lines changed
  • compiler/rustc_middle/src/hir

1 file changed

+6
-0
lines changed

compiler/rustc_middle/src/hir/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ pub struct ModuleItems {
3030
}
3131

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

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

0 commit comments

Comments
 (0)