mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-27 07:03:45 +00:00
Merge #8324
8324: Add `Body::shrink_to_fit` r=jonas-schievink a=jonas-schievink Saves ~15 MB bors r+ Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
commit
c9bcbf9a43
@ -302,7 +302,8 @@ impl Body {
|
||||
}
|
||||
};
|
||||
let expander = Expander::new(db, file_id, module);
|
||||
let (body, source_map) = Body::new(db, expander, params, body);
|
||||
let (mut body, source_map) = Body::new(db, expander, params, body);
|
||||
body.shrink_to_fit();
|
||||
(Arc::new(body), Arc::new(source_map))
|
||||
}
|
||||
|
||||
@ -328,6 +329,15 @@ impl Body {
|
||||
) -> (Body, BodySourceMap) {
|
||||
lower::lower(db, expander, params, body)
|
||||
}
|
||||
|
||||
fn shrink_to_fit(&mut self) {
|
||||
let Self { _c: _, body_expr: _, block_scopes, exprs, labels, params, pats } = self;
|
||||
block_scopes.shrink_to_fit();
|
||||
exprs.shrink_to_fit();
|
||||
labels.shrink_to_fit();
|
||||
params.shrink_to_fit();
|
||||
pats.shrink_to_fit();
|
||||
}
|
||||
}
|
||||
|
||||
impl Index<ExprId> for Body {
|
||||
|
Loading…
Reference in New Issue
Block a user