Skip to content

Commit 34034e4

Browse files
Merge #6353
6353: Get rid of FAKE_PLACEHOLDER r=flodiebold a=flodiebold The lifetime placeholder can be replaced by the static lifetime, and for array sizes we should just be using a concrete const. Co-authored-by: Florian Diebold <[email protected]>
2 parents bf84e49 + 6b5f82b commit 34034e4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

crates/hir_ty/src/traits/chalk/mapping.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
//! conversions.
55
66
use chalk_ir::{
7-
cast::Cast, fold::shift::Shift, interner::HasInterner, PlaceholderIndex, Scalar, TypeName,
8-
UniverseIndex,
7+
cast::Cast, fold::shift::Shift, interner::HasInterner, LifetimeData, PlaceholderIndex, Scalar,
8+
TypeName, UniverseIndex,
99
};
1010
use chalk_solve::rust_ir;
1111

@@ -76,7 +76,7 @@ impl ToChalk for Ty {
7676
);
7777
let bounded_ty = chalk_ir::DynTy {
7878
bounds: make_binders(where_clauses, 1),
79-
lifetime: FAKE_PLACEHOLDER.to_lifetime(&Interner),
79+
lifetime: LifetimeData::Static.intern(&Interner),
8080
};
8181
chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner)
8282
}
@@ -161,9 +161,6 @@ impl ToChalk for Ty {
161161
}
162162
}
163163

164-
const FAKE_PLACEHOLDER: PlaceholderIndex =
165-
PlaceholderIndex { ui: UniverseIndex::ROOT, idx: usize::MAX };
166-
167164
/// We currently don't model lifetimes, but Chalk does. So, we have to insert a
168165
/// fake lifetime here, because Chalks built-in logic may expect it to be there.
169166
fn ref_to_chalk(
@@ -172,7 +169,7 @@ fn ref_to_chalk(
172169
subst: Substs,
173170
) -> chalk_ir::Ty<Interner> {
174171
let arg = subst[0].clone().to_chalk(db);
175-
let lifetime = FAKE_PLACEHOLDER.to_lifetime(&Interner);
172+
let lifetime = LifetimeData::Static.intern(&Interner);
176173
chalk_ir::ApplicationTy {
177174
name: TypeName::Ref(mutability.to_chalk(db)),
178175
substitution: chalk_ir::Substitution::from_iter(
@@ -205,7 +202,11 @@ fn array_to_chalk(db: &dyn HirDatabase, subst: Substs) -> chalk_ir::Ty<Interner>
205202
substitution: chalk_ir::Substitution::empty(&Interner),
206203
}
207204
.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);
209210
chalk_ir::ApplicationTy {
210211
name: TypeName::Array,
211212
substitution: chalk_ir::Substitution::from_iter(

0 commit comments

Comments
 (0)