diff options
author | Florian Diebold <[email protected]> | 2021-04-08 17:25:18 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-08 21:48:47 +0100 |
commit | be03db0e3a75533f34d48c3014d532919b30a9e9 (patch) | |
tree | 3742a817b8238043a3a855d92532c7342815210e /crates/hir_ty/src/lib.rs | |
parent | a169fa6a832a513cd1534d1a6566e4584ca5fb6a (diff) |
Intern Substitutions
(Costs a bit of performance, reduces memory usage on RA by ~10%.)
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 874c95411..beb58d711 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
@@ -109,7 +109,7 @@ pub type WhereClause = chalk_ir::WhereClause<Interner>; | |||
109 | pub fn subst_prefix(s: &Substitution, n: usize) -> Substitution { | 109 | pub fn subst_prefix(s: &Substitution, n: usize) -> Substitution { |
110 | Substitution::from_iter( | 110 | Substitution::from_iter( |
111 | &Interner, | 111 | &Interner, |
112 | s.interned()[..std::cmp::min(s.len(&Interner), n)].iter().cloned(), | 112 | s.as_slice(&Interner)[..std::cmp::min(s.len(&Interner), n)].iter().cloned(), |
113 | ) | 113 | ) |
114 | } | 114 | } |
115 | 115 | ||
@@ -187,7 +187,7 @@ impl CallableSig { | |||
187 | .shifted_out_to(&Interner, DebruijnIndex::ONE) | 187 | .shifted_out_to(&Interner, DebruijnIndex::ONE) |
188 | .expect("unexpected lifetime vars in fn ptr") | 188 | .expect("unexpected lifetime vars in fn ptr") |
189 | .0 | 189 | .0 |
190 | .interned() | 190 | .as_slice(&Interner) |
191 | .iter() | 191 | .iter() |
192 | .map(|arg| arg.assert_ty_ref(&Interner).clone()) | 192 | .map(|arg| arg.assert_ty_ref(&Interner).clone()) |
193 | .collect(), | 193 | .collect(), |