diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-08 22:11:53 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-08 22:11:53 +0100 |
commit | a75763cd57ac6d9cd08846770b8c5f5ba27122df (patch) | |
tree | d33b6ca6fc37c3eaf19980926fa2dd0d59e66b43 /crates/hir_ty/src/infer/expr.rs | |
parent | 63726a91b721e119622e0c7ea106fc5c2e866bf3 (diff) | |
parent | 37ff15ad835ee4ba6d231cac8b1adbd301aec20b (diff) |
Merge #8433
8433: Intern lots of things r=jonas-schievink a=flodiebold
This uses the new interning infrastructure for most type-related things, where it had a positive effect on memory usage and performance. In total, this gives a slight performance improvement and a quite good memory reduction (1119MB->885MB on RA, 1774MB->1188MB on Diesel).
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer/expr.rs')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index cbbfa8b5c..7961f4a52 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -462,7 +462,11 @@ impl<'a> InferenceContext<'a> { | |||
462 | }; | 462 | }; |
463 | match canonicalized.decanonicalize_ty(derefed_ty.value).kind(&Interner) { | 463 | match canonicalized.decanonicalize_ty(derefed_ty.value).kind(&Interner) { |
464 | TyKind::Tuple(_, substs) => name.as_tuple_index().and_then(|idx| { | 464 | TyKind::Tuple(_, substs) => name.as_tuple_index().and_then(|idx| { |
465 | substs.interned().get(idx).map(|a| a.assert_ty_ref(&Interner)).cloned() | 465 | substs |
466 | .as_slice(&Interner) | ||
467 | .get(idx) | ||
468 | .map(|a| a.assert_ty_ref(&Interner)) | ||
469 | .cloned() | ||
466 | }), | 470 | }), |
467 | TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => { | 471 | TyKind::Adt(AdtId(hir_def::AdtId::StructId(s)), parameters) => { |
468 | let local_id = self.db.struct_data(*s).variant_data.field(name)?; | 472 | let local_id = self.db.struct_data(*s).variant_data.field(name)?; |