Skip to content

Commit 9f3fba8

Browse files
committed
resolve: Add comments explaining use of Interned
1 parent c1f412f commit 9f3fba8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

compiler/rustc_resolve/src/imports.rs

+2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ pub(crate) struct ImportData<'a> {
172172
pub used: Cell<bool>,
173173
}
174174

175+
/// All imports are unique and allocated on a same arena,
176+
/// so we can use referential equality to compare them.
175177
pub(crate) type Import<'a> = Interned<'a, ImportData<'a>>;
176178

177179
impl<'a> ImportData<'a> {

compiler/rustc_resolve/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ struct ModuleData<'a> {
514514
expansion: ExpnId,
515515
}
516516

517+
/// All modules are unique and allocated on a same arena,
518+
/// so we can use referential equality to compare them.
517519
#[derive(Clone, Copy, PartialEq)]
518520
#[rustc_pass_by_value]
519521
struct Module<'a>(Interned<'a, ModuleData<'a>>);
@@ -661,6 +663,8 @@ struct NameBindingData<'a> {
661663
vis: ty::Visibility<DefId>,
662664
}
663665

666+
/// All name bindings are unique and allocated on a same arena,
667+
/// so we can use referential equality to compare them.
664668
type NameBinding<'a> = Interned<'a, NameBindingData<'a>>;
665669

666670
trait ToNameBinding<'a> {

0 commit comments

Comments
 (0)