mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Merge #8364
8364: Memory usage improvements r=jonas-schievink a=alexmaco These are mostly focused on splitting up enum variants with large size differences between variants by `Box`-ing things up. In my testing this reduces the memory usage somewhere in the low percentages, even though the measurements are quite noisy. Co-authored-by: Alexandru Macovei <alexnmaco@gmail.com>
This commit is contained in:
commit
7d39b13996
8 changed files with 54 additions and 33 deletions
|
@ -318,7 +318,13 @@ impl<'a> InferenceContext<'a> {
|
|||
self.normalize_associated_types_in(ret_ty)
|
||||
}
|
||||
Expr::MethodCall { receiver, args, method_name, generic_args } => self
|
||||
.infer_method_call(tgt_expr, *receiver, &args, &method_name, generic_args.as_ref()),
|
||||
.infer_method_call(
|
||||
tgt_expr,
|
||||
*receiver,
|
||||
&args,
|
||||
&method_name,
|
||||
generic_args.as_deref(),
|
||||
),
|
||||
Expr::Match { expr, arms } => {
|
||||
let input_ty = self.infer_expr(*expr, &Expectation::none());
|
||||
|
||||
|
@ -399,7 +405,7 @@ impl<'a> InferenceContext<'a> {
|
|||
TyKind::Never.intern(&Interner)
|
||||
}
|
||||
Expr::RecordLit { path, fields, spread } => {
|
||||
let (ty, def_id) = self.resolve_variant(path.as_ref());
|
||||
let (ty, def_id) = self.resolve_variant(path.as_deref());
|
||||
if let Some(variant) = def_id {
|
||||
self.write_variant_resolution(tgt_expr.into(), variant);
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ impl<'a> InferenceContext<'a> {
|
|||
TyKind::Ref(mutability, static_lifetime(), subty).intern(&Interner)
|
||||
}
|
||||
Pat::TupleStruct { path: p, args: subpats, ellipsis } => self.infer_tuple_struct_pat(
|
||||
p.as_ref(),
|
||||
p.as_deref(),
|
||||
subpats,
|
||||
expected,
|
||||
default_bm,
|
||||
|
@ -182,7 +182,7 @@ impl<'a> InferenceContext<'a> {
|
|||
*ellipsis,
|
||||
),
|
||||
Pat::Record { path: p, args: fields, ellipsis: _ } => {
|
||||
self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat)
|
||||
self.infer_record_pat(p.as_deref(), fields, expected, default_bm, pat)
|
||||
}
|
||||
Pat::Path(path) => {
|
||||
// FIXME use correct resolver for the surrounding expression
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue