aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-08 19:55:03 +0100
committerFlorian Diebold <[email protected]>2021-04-08 21:48:47 +0100
commit417473aa3d53fb1a094031251af37ecd71e0cc09 (patch)
treec90491ce25c9e45bd4ac9eb86e0ef3e12dee388f /crates/hir_ty
parentf778e50b7183e727ec7ec1091b9b64471524704a (diff)
Intern Variances
This may be a slight performance improvement.
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/traits/chalk/interner.rs5
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 f35695f6f..f2c9a0d4b 100644
--- a/crates/hir_ty/src/traits/chalk/interner.rs
+++ b/crates/hir_ty/src/traits/chalk/interner.rs
@@ -59,6 +59,7 @@ impl_internable!(
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 InternedWrapper<Vec<chalk_ir::QuantifiedWhereClause<Interner>>>,
62 InternedWrapper<Vec<chalk_ir::Variance>>,
62); 63);
63 64
64impl chalk_ir::interner::Interner for Interner { 65impl chalk_ir::interner::Interner for Interner {
@@ -76,7 +77,7 @@ impl chalk_ir::interner::Interner for Interner {
76 type InternedVariableKinds = Interned<InternedVariableKindsInner>; 77 type InternedVariableKinds = Interned<InternedVariableKindsInner>;
77 type InternedCanonicalVarKinds = Interned<InternedWrapper<Vec<chalk_ir::CanonicalVarKind<Self>>>>; 78 type InternedCanonicalVarKinds = Interned<InternedWrapper<Vec<chalk_ir::CanonicalVarKind<Self>>>>;
78 type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>; 79 type InternedConstraints = Vec<chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>>;
79 type InternedVariances = Arc<[chalk_ir::Variance]>; 80 type InternedVariances = Interned<InternedWrapper<Vec<chalk_ir::Variance>>>;
80 type DefId = InternId; 81 type DefId = InternId;
81 type InternedAdtId = hir_def::AdtId; 82 type InternedAdtId = hir_def::AdtId;
82 type Identifier = TypeAliasId; 83 type Identifier = TypeAliasId;
@@ -413,7 +414,7 @@ impl chalk_ir::interner::Interner for Interner {
413 &self, 414 &self,
414 data: impl IntoIterator<Item = Result<chalk_ir::Variance, E>>, 415 data: impl IntoIterator<Item = Result<chalk_ir::Variance, E>>,
415 ) -> Result<Self::InternedVariances, E> { 416 ) -> Result<Self::InternedVariances, E> {
416 data.into_iter().collect() 417 Ok(Interned::new(InternedWrapper(data.into_iter().collect::<Result<_, _>>()?)))
417 } 418 }
418 419
419 fn variances_data<'a>( 420 fn variances_data<'a>(