diff options
author | Florian Diebold <[email protected]> | 2021-04-08 19:18:51 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-08 21:48:47 +0100 |
commit | 566200342a2bed328d3e73bbb8b8bbe6d49f255c (patch) | |
tree | d342074035d183a4dca31e24a6de677510bae229 /crates/hir_ty/src/traits | |
parent | 15b0b55b4e73fb25d94dd9bcc49a2b4ed5156dc1 (diff) |
Intern QuantifiedWhereClauses
Slight performance and memory usage improvement.
Diffstat (limited to 'crates/hir_ty/src/traits')
-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 11fa2622d..ea42be932 100644 --- a/crates/hir_ty/src/traits/chalk/interner.rs +++ b/crates/hir_ty/src/traits/chalk/interner.rs | |||
@@ -58,6 +58,7 @@ impl_internable!( | |||
58 | InternedWrapper<chalk_ir::ConstData<Interner>>, | 58 | InternedWrapper<chalk_ir::ConstData<Interner>>, |
59 | InternedWrapper<Vec<chalk_ir::CanonicalVarKind<Interner>>>, | 59 | InternedWrapper<Vec<chalk_ir::CanonicalVarKind<Interner>>>, |
60 | InternedWrapper<Vec<chalk_ir::ProgramClause<Interner>>>, | 60 | InternedWrapper<Vec<chalk_ir::ProgramClause<Interner>>>, |
61 | InternedWrapper<Vec<chalk_ir::QuantifiedWhereClause<Interner>>>, | ||
61 | ); | 62 | ); |
62 | 63 | ||
63 | impl chalk_ir::interner::Interner for Interner { | 64 | impl chalk_ir::interner::Interner for Interner { |
@@ -71,7 +72,7 @@ impl chalk_ir::interner::Interner for Interner { | |||
71 | type InternedSubstitution = Interned<InternedSubstitutionInner>; | 72 | type InternedSubstitution = Interned<InternedSubstitutionInner>; |
72 | type InternedProgramClause = Arc<chalk_ir::ProgramClauseData<Self>>; | 73 | type InternedProgramClause = Arc<chalk_ir::ProgramClauseData<Self>>; |
73 | type InternedProgramClauses = Interned<InternedWrapper<Vec<chalk_ir::ProgramClause<Self>>>>; | 74 | type InternedProgramClauses = Interned<InternedWrapper<Vec<chalk_ir::ProgramClause<Self>>>>; |
74 | type InternedQuantifiedWhereClauses = Vec<chalk_ir::QuantifiedWhereClause<Self>>; | 75 | type InternedQuantifiedWhereClauses = Interned<InternedWrapper<Vec<chalk_ir::QuantifiedWhereClause<Self>>>>; |
75 | type InternedVariableKinds = Interned<InternedVariableKindsInner>; | 76 | type InternedVariableKinds = Interned<InternedVariableKindsInner>; |
76 | type InternedCanonicalVarKinds = Interned<InternedWrapper<Vec<chalk_ir::CanonicalVarKind<Self>>>>; | 77 | type InternedCanonicalVarKinds = Interned<InternedWrapper<Vec<chalk_ir::CanonicalVarKind<Self>>>>; |
77 | type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>; | 78 | type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>; |
@@ -342,7 +343,7 @@ impl chalk_ir::interner::Interner for Interner { | |||
342 | &self, | 343 | &self, |
343 | data: impl IntoIterator<Item = Result<chalk_ir::QuantifiedWhereClause<Self>, E>>, | 344 | data: impl IntoIterator<Item = Result<chalk_ir::QuantifiedWhereClause<Self>, E>>, |
344 | ) -> Result<Self::InternedQuantifiedWhereClauses, E> { | 345 | ) -> Result<Self::InternedQuantifiedWhereClauses, E> { |
345 | data.into_iter().collect() | 346 | Ok(Interned::new(InternedWrapper(data.into_iter().collect::<Result<_, _>>()?))) |
346 | } | 347 | } |
347 | 348 | ||
348 | fn quantified_where_clauses_data<'a>( | 349 | fn quantified_where_clauses_data<'a>( |