diff options
author | Florian Diebold <[email protected]> | 2021-04-08 19:06:19 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-08 21:48:47 +0100 |
commit | 317c4b972f5f8da9b5007b8a441a5a79a60a4cd5 (patch) | |
tree | 2c8fac56ec4a64a5d2d19308b3184041cf0bbe24 /crates/hir_ty/src | |
parent | 90656f86745afe073a5b590d51b22ec5f6b60e1b (diff) |
Intern CanonicalVarKinds
Slight savings in performance and memory.
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/traits/chalk/interner.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/hir_ty/src/traits/chalk/interner.rs b/crates/hir_ty/src/traits/chalk/interner.rs index 3a6ceef05..d63252382 100644 --- a/crates/hir_ty/src/traits/chalk/interner.rs +++ b/crates/hir_ty/src/traits/chalk/interner.rs | |||
@@ -56,6 +56,7 @@ impl_internable!( | |||
56 | InternedTypeInner, | 56 | InternedTypeInner, |
57 | InternedWrapper<chalk_ir::LifetimeData<Interner>>, | 57 | InternedWrapper<chalk_ir::LifetimeData<Interner>>, |
58 | InternedWrapper<chalk_ir::ConstData<Interner>>, | 58 | InternedWrapper<chalk_ir::ConstData<Interner>>, |
59 | InternedWrapper<Vec<chalk_ir::CanonicalVarKind<Interner>>>, | ||
59 | ); | 60 | ); |
60 | 61 | ||
61 | impl chalk_ir::interner::Interner for Interner { | 62 | impl chalk_ir::interner::Interner for Interner { |
@@ -71,7 +72,7 @@ impl chalk_ir::interner::Interner for Interner { | |||
71 | type InternedProgramClauses = Arc<[chalk_ir::ProgramClause<Self>]>; | 72 | type InternedProgramClauses = Arc<[chalk_ir::ProgramClause<Self>]>; |
72 | type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>; | 73 | type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>; |
73 | type InternedVariableKinds = Interned<InternedVariableKindsInner>; | 74 | type InternedVariableKinds = Interned<InternedVariableKindsInner>; |
74 | type InternedCanonicalVarKinds = Vec<chalk_ir::CanonicalVarKind<Self>>; | 75 | type InternedCanonicalVarKinds = Interned<InternedWrapper<Vec<chalk_ir::CanonicalVarKind<Self>>>>; |
75 | type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>; | 76 | type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>; |
76 | type InternedVariances = Arc<[chalk_ir::Variance]>; | 77 | type InternedVariances = Arc<[chalk_ir::Variance]>; |
77 | type DefId = InternId; | 78 | type DefId = InternId; |
@@ -370,7 +371,7 @@ impl chalk_ir::interner::Interner for Interner { | |||
370 | &self, | 371 | &self, |
371 | data: impl IntoIterator<Item = Result<chalk_ir::CanonicalVarKind<Self>, E>>, | 372 | data: impl IntoIterator<Item = Result<chalk_ir::CanonicalVarKind<Self>, E>>, |
372 | ) -> Result<Self::InternedCanonicalVarKinds, E> { | 373 | ) -> Result<Self::InternedCanonicalVarKinds, E> { |
373 | data.into_iter().collect() | 374 | Ok(Interned::new(InternedWrapper(data.into_iter().collect::<Result<_, _>>()?))) |
374 | } | 375 | } |
375 | 376 | ||
376 | fn canonical_var_kinds_data<'a>( | 377 | fn canonical_var_kinds_data<'a>( |