aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/hir_ty/src/traits/chalk/mapping.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs
index be3301313..dd7affcec 100644
--- a/crates/hir_ty/src/traits/chalk/mapping.rs
+++ b/crates/hir_ty/src/traits/chalk/mapping.rs
@@ -4,8 +4,8 @@
4//! conversions. 4//! conversions.
5 5
6use chalk_ir::{ 6use chalk_ir::{
7 cast::Cast, fold::shift::Shift, interner::HasInterner, PlaceholderIndex, Scalar, TypeName, 7 cast::Cast, fold::shift::Shift, interner::HasInterner, LifetimeData, PlaceholderIndex, Scalar,
8 UniverseIndex, 8 TypeName, UniverseIndex,
9}; 9};
10use chalk_solve::rust_ir; 10use chalk_solve::rust_ir;
11 11
@@ -76,7 +76,7 @@ impl ToChalk for Ty {
76 ); 76 );
77 let bounded_ty = chalk_ir::DynTy { 77 let bounded_ty = chalk_ir::DynTy {
78 bounds: make_binders(where_clauses, 1), 78 bounds: make_binders(where_clauses, 1),
79 lifetime: FAKE_PLACEHOLDER.to_lifetime(&Interner), 79 lifetime: LifetimeData::Static.intern(&Interner),
80 }; 80 };
81 chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner) 81 chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner)
82 } 82 }
@@ -161,9 +161,6 @@ impl ToChalk for Ty {
161 } 161 }
162} 162}
163 163
164const FAKE_PLACEHOLDER: PlaceholderIndex =
165 PlaceholderIndex { ui: UniverseIndex::ROOT, idx: usize::MAX };
166
167/// We currently don't model lifetimes, but Chalk does. So, we have to insert a 164/// We currently don't model lifetimes, but Chalk does. So, we have to insert a
168/// fake lifetime here, because Chalks built-in logic may expect it to be there. 165/// fake lifetime here, because Chalks built-in logic may expect it to be there.
169fn ref_to_chalk( 166fn ref_to_chalk(
@@ -172,7 +169,7 @@ fn ref_to_chalk(
172 subst: Substs, 169 subst: Substs,
173) -> chalk_ir::Ty<Interner> { 170) -> chalk_ir::Ty<Interner> {
174 let arg = subst[0].clone().to_chalk(db); 171 let arg = subst[0].clone().to_chalk(db);
175 let lifetime = FAKE_PLACEHOLDER.to_lifetime(&Interner); 172 let lifetime = LifetimeData::Static.intern(&Interner);
176 chalk_ir::ApplicationTy { 173 chalk_ir::ApplicationTy {
177 name: TypeName::Ref(mutability.to_chalk(db)), 174 name: TypeName::Ref(mutability.to_chalk(db)),
178 substitution: chalk_ir::Substitution::from_iter( 175 substitution: chalk_ir::Substitution::from_iter(
@@ -205,7 +202,11 @@ fn array_to_chalk(db: &dyn HirDatabase, subst: Substs) -> chalk_ir::Ty<Interner>
205 substitution: chalk_ir::Substitution::empty(&Interner), 202 substitution: chalk_ir::Substitution::empty(&Interner),
206 } 203 }
207 .intern(&Interner); 204 .intern(&Interner);
208 let const_ = FAKE_PLACEHOLDER.to_const(&Interner, usize_ty); 205 let const_ = chalk_ir::ConstData {
206 ty: usize_ty,
207 value: chalk_ir::ConstValue::Concrete(chalk_ir::ConcreteConst { interned: () }),
208 }
209 .intern(&Interner);
209 chalk_ir::ApplicationTy { 210 chalk_ir::ApplicationTy {
210 name: TypeName::Array, 211 name: TypeName::Array,
211 substitution: chalk_ir::Substitution::from_iter( 212 substitution: chalk_ir::Substitution::from_iter(