about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-03-20 12:06:07 +0100
committerRalf Jung <post@ralfj.de>2024-03-21 14:26:29 +0100
commit1e926b50d7011e58f2855358b436d6f188e4579a (patch)
tree9022e057cb32acb72ad1d9e20111839170f419f6
parentdf8ac8f1d74cffb96a93ae702d16e224f5b9ee8c (diff)
downloadrust-1e926b50d7011e58f2855358b436d6f188e4579a.tar.gz
rust-1e926b50d7011e58f2855358b436d6f188e4579a.zip
add some comments to hir::ModuleItems
-rw-r--r--compiler/rustc_middle/src/hir/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs
index f9fa8ac2f7a..8ebdd92ad0c 100644
--- a/compiler/rustc_middle/src/hir/mod.rs
+++ b/compiler/rustc_middle/src/hir/mod.rs
@@ -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()
     }
@@ -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()
     }