From f04f38d3d79c3cc51956bc530a34e32945cdb294 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 7 Apr 2021 03:12:40 +0200 Subject: nameres: collect unnamed consts --- crates/hir_def/src/item_scope.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'crates/hir_def/src/item_scope.rs') diff --git a/crates/hir_def/src/item_scope.rs b/crates/hir_def/src/item_scope.rs index a8ee5eeac..08feee1e7 100644 --- a/crates/hir_def/src/item_scope.rs +++ b/crates/hir_def/src/item_scope.rs @@ -11,7 +11,7 @@ use rustc_hash::{FxHashMap, FxHashSet}; use stdx::format_to; use crate::{ - db::DefDatabase, per_ns::PerNs, visibility::Visibility, AdtId, BuiltinType, ImplId, + db::DefDatabase, per_ns::PerNs, visibility::Visibility, AdtId, BuiltinType, ConstId, ImplId, LocalModuleId, MacroDefId, ModuleDefId, ModuleId, TraitId, }; @@ -37,6 +37,7 @@ pub struct ItemScope { defs: Vec, impls: Vec, + unnamed_consts: Vec, /// Traits imported via `use Trait as _;`. unnamed_trait_imports: FxHashMap, /// Macros visible in current module in legacy textual scope @@ -156,6 +157,10 @@ impl ItemScope { self.impls.push(imp) } + pub(crate) fn define_unnamed_const(&mut self, konst: ConstId) { + self.unnamed_consts.push(konst); + } + pub(crate) fn define_legacy_macro(&mut self, name: Name, mac: MacroDefId) { self.legacy_macros.insert(name, mac); } @@ -295,6 +300,7 @@ impl ItemScope { unresolved, defs, impls, + unnamed_consts, unnamed_trait_imports, legacy_macros, } = self; @@ -304,6 +310,7 @@ impl ItemScope { unresolved.shrink_to_fit(); defs.shrink_to_fit(); impls.shrink_to_fit(); + unnamed_consts.shrink_to_fit(); unnamed_trait_imports.shrink_to_fit(); legacy_macros.shrink_to_fit(); } -- cgit v1.2.3