]> git.lizzy.rs Git - rust.git/commitdiff
add more counts
authorAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 27 Jan 2021 09:16:24 +0000 (12:16 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 27 Jan 2021 09:16:24 +0000 (12:16 +0300)
crates/hir_def/src/body.rs
crates/hir_def/src/body/lower.rs
crates/hir_expand/src/ast_id_map.rs

index d0c84ab0b5907771018aca94e9725ff853fbea14..b9ecf22fa5f20236bead91e87a2583defcdfa614 100644 (file)
@@ -17,6 +17,7 @@
     HirFileId, InFile, MacroDefId,
 };
 use la_arena::{Arena, ArenaMap};
+use profile::Count;
 use rustc_hash::FxHashMap;
 use syntax::{ast, AstNode, AstPtr};
 use test_utils::mark;
@@ -237,6 +238,7 @@ pub struct Body {
     /// The `ExprId` of the actual body expression.
     pub body_expr: ExprId,
     pub item_scope: ItemScope,
+    _c: Count<Self>,
 }
 
 pub type ExprPtr = AstPtr<ast::Expr>;
index 4ce5e5b72c319b9db9d1f35c8a49f501ebfeec5c..209965fcaf74116de7d5e97e0246c8fdbc6ff20e 100644 (file)
@@ -10,6 +10,7 @@
     ExpandError, HirFileId, MacroDefId, MacroDefKind,
 };
 use la_arena::Arena;
+use profile::Count;
 use rustc_hash::FxHashMap;
 use syntax::{
     ast::{
@@ -77,6 +78,7 @@ pub(super) fn lower(
             params: Vec::new(),
             body_expr: dummy_expr_id(),
             item_scope: Default::default(),
+            _c: Count::new(),
         },
         item_trees: {
             let mut map = FxHashMap::default();
index 0991fffd8581f2f8dd29791ec5857371816dd5de..16cf299076f295601fe704cdd015d498ecfd91ab 100644 (file)
@@ -13,6 +13,7 @@
 };
 
 use la_arena::{Arena, Idx};
+use profile::Count;
 use syntax::{ast, match_ast, AstNode, AstPtr, SyntaxNode, SyntaxNodePtr};
 
 /// `AstId` points to an AST node in a specific file.
@@ -62,12 +63,13 @@ pub fn upcast<M: AstNode>(self) -> FileAstId<M>
 #[derive(Debug, PartialEq, Eq, Default)]
 pub struct AstIdMap {
     arena: Arena<SyntaxNodePtr>,
+    _c: Count<Self>,
 }
 
 impl AstIdMap {
     pub(crate) fn from_source(node: &SyntaxNode) -> AstIdMap {
         assert!(node.parent().is_none());
-        let mut res = AstIdMap { arena: Arena::default() };
+        let mut res = AstIdMap::default();
         // By walking the tree in breadth-first order we make sure that parents
         // get lower ids then children. That is, adding a new child does not
         // change parent's id. This means that, say, adding a new function to a