mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
internal: count ItemScopes
This commit is contained in:
parent
4772cb6b30
commit
260a24d05e
1 changed files with 4 additions and 0 deletions
|
@ -6,6 +6,7 @@ use std::collections::hash_map::Entry;
|
||||||
use base_db::CrateId;
|
use base_db::CrateId;
|
||||||
use hir_expand::{name::Name, AstId, MacroCallId, MacroDefKind};
|
use hir_expand::{name::Name, AstId, MacroCallId, MacroDefKind};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
use profile::Count;
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
use rustc_hash::{FxHashMap, FxHashSet};
|
||||||
use stdx::format_to;
|
use stdx::format_to;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
@ -30,6 +31,8 @@ pub struct PerNsGlobImports {
|
||||||
|
|
||||||
#[derive(Debug, Default, PartialEq, Eq)]
|
#[derive(Debug, Default, PartialEq, Eq)]
|
||||||
pub struct ItemScope {
|
pub struct ItemScope {
|
||||||
|
_c: Count<Self>,
|
||||||
|
|
||||||
/// Defs visible in this scope. This includes `declarations`, but also
|
/// Defs visible in this scope. This includes `declarations`, but also
|
||||||
/// imports.
|
/// imports.
|
||||||
types: FxHashMap<Name, (ModuleDefId, Visibility)>,
|
types: FxHashMap<Name, (ModuleDefId, Visibility)>,
|
||||||
|
@ -311,6 +314,7 @@ impl ItemScope {
|
||||||
pub(crate) fn shrink_to_fit(&mut self) {
|
pub(crate) fn shrink_to_fit(&mut self) {
|
||||||
// Exhaustive match to require handling new fields.
|
// Exhaustive match to require handling new fields.
|
||||||
let Self {
|
let Self {
|
||||||
|
_c: _,
|
||||||
types,
|
types,
|
||||||
values,
|
values,
|
||||||
macros,
|
macros,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue