aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-22 19:03:38 +0100
committerGitHub <[email protected]>2021-06-22 19:03:38 +0100
commit9239943b84ec2bd687c4c80d2c3a0df4f8caf31c (patch)
tree0176dc6c74ba31b3540d7063b70b2fedddd8cadd
parent0e0d77d0a3361ee08cdb08a9060f5aa6160a5741 (diff)
parent260a24d05e8392da4ab5eb3ebe45de81d4f72f50 (diff)
Merge #9377
9377: internal: count ItemScopes r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/hir_def/src/item_scope.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_scope.rs b/crates/hir_def/src/item_scope.rs
index 1b7cb7c8b..0d364b1cb 100644
--- a/crates/hir_def/src/item_scope.rs
+++ b/crates/hir_def/src/item_scope.rs
@@ -6,6 +6,7 @@ use std::collections::hash_map::Entry;
6use base_db::CrateId; 6use base_db::CrateId;
7use hir_expand::{name::Name, AstId, MacroCallId, MacroDefKind}; 7use hir_expand::{name::Name, AstId, MacroCallId, MacroDefKind};
8use once_cell::sync::Lazy; 8use once_cell::sync::Lazy;
9use profile::Count;
9use rustc_hash::{FxHashMap, FxHashSet}; 10use rustc_hash::{FxHashMap, FxHashSet};
10use stdx::format_to; 11use stdx::format_to;
11use syntax::ast; 12use syntax::ast;
@@ -30,6 +31,8 @@ pub struct PerNsGlobImports {
30 31
31#[derive(Debug, Default, PartialEq, Eq)] 32#[derive(Debug, Default, PartialEq, Eq)]
32pub struct ItemScope { 33pub struct ItemScope {
34 _c: Count<Self>,
35
33 /// Defs visible in this scope. This includes `declarations`, but also 36 /// Defs visible in this scope. This includes `declarations`, but also
34 /// imports. 37 /// imports.
35 types: FxHashMap<Name, (ModuleDefId, Visibility)>, 38 types: FxHashMap<Name, (ModuleDefId, Visibility)>,
@@ -311,6 +314,7 @@ impl ItemScope {
311 pub(crate) fn shrink_to_fit(&mut self) { 314 pub(crate) fn shrink_to_fit(&mut self) {
312 // Exhaustive match to require handling new fields. 315 // Exhaustive match to require handling new fields.
313 let Self { 316 let Self {
317 _c: _,
314 types, 318 types,
315 values, 319 values,
316 macros, 320 macros,