aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def')
-rw-r--r--crates/hir_def/src/body.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/hir_def/src/body.rs b/crates/hir_def/src/body.rs
index ad3d5afbe..a5fc652a7 100644
--- a/crates/hir_def/src/body.rs
+++ b/crates/hir_def/src/body.rs
@@ -302,7 +302,8 @@ impl Body {
302 } 302 }
303 }; 303 };
304 let expander = Expander::new(db, file_id, module); 304 let expander = Expander::new(db, file_id, module);
305 let (body, source_map) = Body::new(db, expander, params, body); 305 let (mut body, source_map) = Body::new(db, expander, params, body);
306 body.shrink_to_fit();
306 (Arc::new(body), Arc::new(source_map)) 307 (Arc::new(body), Arc::new(source_map))
307 } 308 }
308 309
@@ -328,6 +329,15 @@ impl Body {
328 ) -> (Body, BodySourceMap) { 329 ) -> (Body, BodySourceMap) {
329 lower::lower(db, expander, params, body) 330 lower::lower(db, expander, params, body)
330 } 331 }
332
333 fn shrink_to_fit(&mut self) {
334 let Self { _c: _, body_expr: _, block_scopes, exprs, labels, params, pats } = self;
335 block_scopes.shrink_to_fit();
336 exprs.shrink_to_fit();
337 labels.shrink_to_fit();
338 params.shrink_to_fit();
339 pats.shrink_to_fit();
340 }
331} 341}
332 342
333impl Index<ExprId> for Body { 343impl Index<ExprId> for Body {