Merge #9376
9376: minor: clarify naming r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
0e0d77d0a3
@ -30,12 +30,16 @@ pub struct PerNsGlobImports {
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq)]
|
||||
pub struct ItemScope {
|
||||
/// Defs visible in this scope. This includes `declarations`, but also
|
||||
/// imports.
|
||||
types: FxHashMap<Name, (ModuleDefId, Visibility)>,
|
||||
values: FxHashMap<Name, (ModuleDefId, Visibility)>,
|
||||
macros: FxHashMap<Name, (MacroDefId, Visibility)>,
|
||||
unresolved: FxHashSet<Name>,
|
||||
|
||||
defs: Vec<ModuleDefId>,
|
||||
/// The defs declared in this scope. Each def has a single scope where it is
|
||||
/// declared.
|
||||
declarations: Vec<ModuleDefId>,
|
||||
impls: Vec<ImplId>,
|
||||
unnamed_consts: Vec<ConstId>,
|
||||
/// Traits imported via `use Trait as _;`.
|
||||
@ -89,7 +93,7 @@ pub fn entries<'a>(&'a self) -> impl Iterator<Item = (&'a Name, PerNs)> + 'a {
|
||||
}
|
||||
|
||||
pub fn declarations(&self) -> impl Iterator<Item = ModuleDefId> + '_ {
|
||||
self.defs.iter().copied()
|
||||
self.declarations.iter().copied()
|
||||
}
|
||||
|
||||
pub fn impls(&self) -> impl Iterator<Item = ImplId> + ExactSizeIterator + '_ {
|
||||
@ -150,8 +154,8 @@ pub(crate) fn traits<'a>(&'a self) -> impl Iterator<Item = TraitId> + 'a {
|
||||
.chain(self.unnamed_trait_imports.keys().copied())
|
||||
}
|
||||
|
||||
pub(crate) fn define_def(&mut self, def: ModuleDefId) {
|
||||
self.defs.push(def)
|
||||
pub(crate) fn declare(&mut self, def: ModuleDefId) {
|
||||
self.declarations.push(def)
|
||||
}
|
||||
|
||||
pub(crate) fn get_legacy_macro(&self, name: &Name) -> Option<MacroDefId> {
|
||||
@ -311,7 +315,7 @@ pub(crate) fn shrink_to_fit(&mut self) {
|
||||
values,
|
||||
macros,
|
||||
unresolved,
|
||||
defs,
|
||||
declarations: defs,
|
||||
impls,
|
||||
unnamed_consts,
|
||||
unnamed_trait_imports,
|
||||
|
@ -1506,7 +1506,7 @@ fn collect(&mut self, items: &[ModItem]) {
|
||||
}
|
||||
|
||||
if let Some(DefData { id, name, visibility, has_constructor }) = def {
|
||||
self.def_collector.def_map.modules[self.module_id].scope.define_def(id);
|
||||
self.def_collector.def_map.modules[self.module_id].scope.declare(id);
|
||||
let vis = self
|
||||
.def_collector
|
||||
.def_map
|
||||
@ -1627,7 +1627,7 @@ fn push_child_module(
|
||||
modules[self.module_id].children.insert(name.clone(), res);
|
||||
let module = self.def_collector.def_map.module_id(res);
|
||||
let def: ModuleDefId = module.into();
|
||||
self.def_collector.def_map.modules[self.module_id].scope.define_def(def);
|
||||
self.def_collector.def_map.modules[self.module_id].scope.declare(def);
|
||||
self.def_collector.update(
|
||||
self.module_id,
|
||||
&[(Some(name), PerNs::from_def(def, vis, false))],
|
||||
|
Loading…
Reference in New Issue
Block a user