aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/hir_expand/src/hygiene.rs2
-rw-r--r--crates/mbe/src/syntax_bridge.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/crates/hir_expand/src/hygiene.rs b/crates/hir_expand/src/hygiene.rs
index 8db581b77..c8ea81210 100644
--- a/crates/hir_expand/src/hygiene.rs
+++ b/crates/hir_expand/src/hygiene.rs
@@ -76,6 +76,8 @@ pub struct HygieneFrame {
76 76
77impl HygieneFrames { 77impl HygieneFrames {
78 fn new(db: &dyn AstDatabase, file_id: HirFileId) -> Self { 78 fn new(db: &dyn AstDatabase, file_id: HirFileId) -> Self {
79 // Note that this intentionally avoids the `hygiene_frame` query to avoid blowing up memory
80 // usage. The query is only helpful for nested `HygieneFrame`s as it avoids redundant work.
79 HygieneFrames(Arc::new(HygieneFrame::new(db, file_id))) 81 HygieneFrames(Arc::new(HygieneFrame::new(db, file_id)))
80 } 82 }
81 83
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs
index e648519f9..2a41d8167 100644
--- a/crates/mbe/src/syntax_bridge.rs
+++ b/crates/mbe/src/syntax_bridge.rs
@@ -51,6 +51,7 @@ pub fn syntax_node_to_token_tree(node: &SyntaxNode) -> Option<(tt::Subtree, Toke
51 let global_offset = node.text_range().start(); 51 let global_offset = node.text_range().start();
52 let mut c = Convertor::new(node, global_offset); 52 let mut c = Convertor::new(node, global_offset);
53 let subtree = c.go()?; 53 let subtree = c.go()?;
54 c.id_alloc.map.entries.shrink_to_fit();
54 Some((subtree, c.id_alloc.map)) 55 Some((subtree, c.id_alloc.map))
55} 56}
56 57
@@ -593,7 +594,8 @@ impl<'a> TtTreeSink<'a> {
593 } 594 }
594 } 595 }
595 596
596 fn finish(self) -> (Parse<SyntaxNode>, TokenMap) { 597 fn finish(mut self) -> (Parse<SyntaxNode>, TokenMap) {
598 self.token_map.entries.shrink_to_fit();
597 (self.inner.finish(), self.token_map) 599 (self.inner.finish(), self.token_map)
598 } 600 }
599} 601}