diff options
Diffstat (limited to 'crates/hir_ty/src/traits/chalk')
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index 6a8b6752e..d969527dc 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -15,7 +15,7 @@ use crate::{ | |||
15 | primitive::UintTy, | 15 | primitive::UintTy, |
16 | traits::{Canonical, Obligation}, | 16 | traits::{Canonical, Obligation}, |
17 | AliasTy, CallableDefId, FnPointer, GenericPredicate, InEnvironment, OpaqueTy, | 17 | AliasTy, CallableDefId, FnPointer, GenericPredicate, InEnvironment, OpaqueTy, |
18 | ProjectionPredicate, ProjectionTy, Scalar, Substs, TraitRef, Ty, | 18 | ProjectionPredicate, ProjectionTy, Scalar, Substitution, TraitRef, Ty, |
19 | }; | 19 | }; |
20 | 20 | ||
21 | use super::interner::*; | 21 | use super::interner::*; |
@@ -52,7 +52,7 @@ impl ToChalk for Ty { | |||
52 | 52 | ||
53 | TyKind::Tuple(cardinality, substs) => { | 53 | TyKind::Tuple(cardinality, substs) => { |
54 | let substitution = substs.to_chalk(db); | 54 | let substitution = substs.to_chalk(db); |
55 | chalk_ir::TyKind::Tuple(cardinality.into(), substitution).intern(&Interner) | 55 | chalk_ir::TyKind::Tuple(cardinality, substitution).intern(&Interner) |
56 | } | 56 | } |
57 | TyKind::Raw(mutability, ty) => { | 57 | TyKind::Raw(mutability, ty) => { |
58 | let ty = ty.to_chalk(db); | 58 | let ty = ty.to_chalk(db); |
@@ -134,7 +134,7 @@ impl ToChalk for Ty { | |||
134 | .. | 134 | .. |
135 | }) => { | 135 | }) => { |
136 | assert_eq!(num_binders, 0); | 136 | assert_eq!(num_binders, 0); |
137 | let substs: Substs = from_chalk( | 137 | let substs: Substitution = from_chalk( |
138 | db, | 138 | db, |
139 | substitution.0.shifted_out(&Interner).expect("fn ptr should have no binders"), | 139 | substitution.0.shifted_out(&Interner).expect("fn ptr should have no binders"), |
140 | ); | 140 | ); |
@@ -213,14 +213,17 @@ fn array_to_chalk(db: &dyn HirDatabase, ty: Ty) -> chalk_ir::Ty<Interner> { | |||
213 | chalk_ir::TyKind::Array(arg, const_).intern(&Interner) | 213 | chalk_ir::TyKind::Array(arg, const_).intern(&Interner) |
214 | } | 214 | } |
215 | 215 | ||
216 | impl ToChalk for Substs { | 216 | impl ToChalk for Substitution { |
217 | type Chalk = chalk_ir::Substitution<Interner>; | 217 | type Chalk = chalk_ir::Substitution<Interner>; |
218 | 218 | ||
219 | fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Substitution<Interner> { | 219 | fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Substitution<Interner> { |
220 | chalk_ir::Substitution::from_iter(&Interner, self.iter().map(|ty| ty.clone().to_chalk(db))) | 220 | chalk_ir::Substitution::from_iter(&Interner, self.iter().map(|ty| ty.clone().to_chalk(db))) |
221 | } | 221 | } |
222 | 222 | ||
223 | fn from_chalk(db: &dyn HirDatabase, parameters: chalk_ir::Substitution<Interner>) -> Substs { | 223 | fn from_chalk( |
224 | db: &dyn HirDatabase, | ||
225 | parameters: chalk_ir::Substitution<Interner>, | ||
226 | ) -> Substitution { | ||
224 | let tys = parameters | 227 | let tys = parameters |
225 | .iter(&Interner) | 228 | .iter(&Interner) |
226 | .map(|p| match p.ty(&Interner) { | 229 | .map(|p| match p.ty(&Interner) { |
@@ -228,7 +231,7 @@ impl ToChalk for Substs { | |||
228 | None => unimplemented!(), | 231 | None => unimplemented!(), |
229 | }) | 232 | }) |
230 | .collect(); | 233 | .collect(); |
231 | Substs(tys) | 234 | Substitution(tys) |
232 | } | 235 | } |
233 | } | 236 | } |
234 | 237 | ||
@@ -489,7 +492,7 @@ where | |||
489 | pub(super) fn convert_where_clauses( | 492 | pub(super) fn convert_where_clauses( |
490 | db: &dyn HirDatabase, | 493 | db: &dyn HirDatabase, |
491 | def: GenericDefId, | 494 | def: GenericDefId, |
492 | substs: &Substs, | 495 | substs: &Substitution, |
493 | ) -> Vec<chalk_ir::QuantifiedWhereClause<Interner>> { | 496 | ) -> Vec<chalk_ir::QuantifiedWhereClause<Interner>> { |
494 | let generic_predicates = db.generic_predicates(def); | 497 | let generic_predicates = db.generic_predicates(def); |
495 | let mut result = Vec::with_capacity(generic_predicates.len()); | 498 | let mut result = Vec::with_capacity(generic_predicates.len()); |