diff options
author | Florian Diebold <[email protected]> | 2021-03-13 18:47:34 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-03-13 18:47:34 +0000 |
commit | 1bf6b7360c3f1d0e20dece5227979bc4d74a352f (patch) | |
tree | 13a5ae932c1af88d50bbde849ea6d4c317d196f2 /crates/hir_ty/src/traits/chalk | |
parent | 2d69eb131f58dee1bc188b8df8d5cf0ebf9d97f2 (diff) |
Use chalk_ir::PlaceholderIndex
Diffstat (limited to 'crates/hir_ty/src/traits/chalk')
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index 56a30363b..460955756 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -3,10 +3,7 @@ | |||
3 | //! Chalk (in both directions); plus some helper functions for more specialized | 3 | //! Chalk (in both directions); plus some helper functions for more specialized |
4 | //! conversions. | 4 | //! conversions. |
5 | 5 | ||
6 | use chalk_ir::{ | 6 | use chalk_ir::{cast::Cast, fold::shift::Shift, interner::HasInterner, LifetimeData}; |
7 | cast::Cast, fold::shift::Shift, interner::HasInterner, LifetimeData, PlaceholderIndex, | ||
8 | UniverseIndex, | ||
9 | }; | ||
10 | use chalk_solve::rust_ir; | 7 | use chalk_solve::rust_ir; |
11 | 8 | ||
12 | use base_db::salsa::InternKey; | 9 | use base_db::salsa::InternKey; |
@@ -91,14 +88,7 @@ impl ToChalk for Ty { | |||
91 | .cast(&Interner) | 88 | .cast(&Interner) |
92 | .intern(&Interner) | 89 | .intern(&Interner) |
93 | } | 90 | } |
94 | TyKind::Placeholder(id) => { | 91 | TyKind::Placeholder(idx) => idx.to_ty::<Interner>(&Interner), |
95 | let interned_id = db.intern_type_param_id(id); | ||
96 | PlaceholderIndex { | ||
97 | ui: UniverseIndex::ROOT, | ||
98 | idx: interned_id.as_intern_id().as_usize(), | ||
99 | } | ||
100 | .to_ty::<Interner>(&Interner) | ||
101 | } | ||
102 | TyKind::BoundVar(idx) => chalk_ir::TyKind::BoundVar(idx).intern(&Interner), | 92 | TyKind::BoundVar(idx) => chalk_ir::TyKind::BoundVar(idx).intern(&Interner), |
103 | TyKind::InferenceVar(..) => panic!("uncanonicalized infer ty"), | 93 | TyKind::InferenceVar(..) => panic!("uncanonicalized infer ty"), |
104 | TyKind::Dyn(predicates) => { | 94 | TyKind::Dyn(predicates) => { |
@@ -128,13 +118,7 @@ impl ToChalk for Ty { | |||
128 | match chalk.data(&Interner).kind.clone() { | 118 | match chalk.data(&Interner).kind.clone() { |
129 | chalk_ir::TyKind::Error => TyKind::Unknown, | 119 | chalk_ir::TyKind::Error => TyKind::Unknown, |
130 | chalk_ir::TyKind::Array(ty, _size) => TyKind::Array(Substs::single(from_chalk(db, ty))), | 120 | chalk_ir::TyKind::Array(ty, _size) => TyKind::Array(Substs::single(from_chalk(db, ty))), |
131 | chalk_ir::TyKind::Placeholder(idx) => { | 121 | chalk_ir::TyKind::Placeholder(idx) => TyKind::Placeholder(idx), |
132 | assert_eq!(idx.ui, UniverseIndex::ROOT); | ||
133 | let interned_id = crate::db::GlobalTypeParamId::from_intern_id( | ||
134 | crate::salsa::InternId::from(idx.idx), | ||
135 | ); | ||
136 | TyKind::Placeholder(db.lookup_intern_type_param_id(interned_id)) | ||
137 | } | ||
138 | chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Projection(proj)) => { | 122 | chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Projection(proj)) => { |
139 | let associated_ty = proj.associated_ty_id; | 123 | let associated_ty = proj.associated_ty_id; |
140 | let parameters = from_chalk(db, proj.substitution); | 124 | let parameters = from_chalk(db, proj.substitution); |