about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2023-07-05 13:46:42 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2023-07-05 13:47:37 +0300
commit9f3fba8da81300dc1a734a9cb1e2d804286b4f8d (patch)
treefd8c134c466c25bb2ccf85f1dc91b03eefbe97c3
parentc1f412f9a93cee5bfd4c4cbdf0e0cb78fc51da2c (diff)
downloadrust-9f3fba8da81300dc1a734a9cb1e2d804286b4f8d.tar.gz
rust-9f3fba8da81300dc1a734a9cb1e2d804286b4f8d.zip
resolve: Add comments explaining use of `Interned`
-rw-r--r--compiler/rustc_resolve/src/imports.rs2
-rw-r--r--compiler/rustc_resolve/src/lib.rs4
2 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs
index 036fbf2dbf0..d37fe783bba 100644
--- a/compiler/rustc_resolve/src/imports.rs
+++ b/compiler/rustc_resolve/src/imports.rs
@@ -172,6 +172,8 @@ pub(crate) struct ImportData<'a> {
     pub used: Cell<bool>,
 }
 
+/// All imports are unique and allocated on a same arena,
+/// so we can use referential equality to compare them.
 pub(crate) type Import<'a> = Interned<'a, ImportData<'a>>;
 
 impl<'a> ImportData<'a> {
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs
index b6a312c2982..da3d86a4718 100644
--- a/compiler/rustc_resolve/src/lib.rs
+++ b/compiler/rustc_resolve/src/lib.rs
@@ -514,6 +514,8 @@ struct ModuleData<'a> {
     expansion: ExpnId,
 }
 
+/// All modules are unique and allocated on a same arena,
+/// so we can use referential equality to compare them.
 #[derive(Clone, Copy, PartialEq)]
 #[rustc_pass_by_value]
 struct Module<'a>(Interned<'a, ModuleData<'a>>);
@@ -661,6 +663,8 @@ struct NameBindingData<'a> {
     vis: ty::Visibility<DefId>,
 }
 
+/// All name bindings are unique and allocated on a same arena,
+/// so we can use referential equality to compare them.
 type NameBinding<'a> = Interned<'a, NameBindingData<'a>>;
 
 trait ToNameBinding<'a> {