resolve: Add comments explaining use of Interned
This commit is contained in:
parent
c1f412f9a9
commit
9f3fba8da8
2 changed files with 6 additions and 0 deletions
|
@ -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> {
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Add table
Reference in a new issue