Skip to content

Commit 34abc6f

Browse files
committed
add const types
1 parent cf495e4 commit 34abc6f

File tree

23 files changed

+379
-278
lines changed

23 files changed

+379
-278
lines changed

chalk-integration/src/interner.rs

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::tls;
22
use chalk_ir::interner::{HasInterner, Interner};
33
use chalk_ir::{
4-
AliasTy, ApplicationTy, AssocTypeId, CanonicalVarKind, CanonicalVarKinds, Goals, Lifetime,
5-
OpaqueTy, OpaqueTyId, ProgramClauseImplication, ProgramClauses, ProjectionTy,
4+
AliasTy, ApplicationTy, AssocTypeId, CanonicalVarKind, CanonicalVarKinds, ConstData, Goals,
5+
Lifetime, OpaqueTy, OpaqueTyId, ProgramClauseImplication, ProgramClauses, ProjectionTy,
66
QuantifiedWhereClauses, SeparatorTraitRef, Substitution, TraitId, Ty, VariableKind,
77
VariableKinds,
88
};
@@ -36,6 +36,8 @@ pub struct ChalkIr;
3636
impl Interner for ChalkIr {
3737
type InternedType = Arc<TyData<ChalkIr>>;
3838
type InternedLifetime = LifetimeData<ChalkIr>;
39+
type InternedConst = Arc<ConstData<ChalkIr>>;
40+
type InternedConcreteConst = u32;
3941
type InternedGenericArg = GenericArgData<ChalkIr>;
4042
type InternedGoal = Arc<GoalData<ChalkIr>>;
4143
type InternedGoals = Vec<Goal<ChalkIr>>;
@@ -213,6 +215,18 @@ impl Interner for ChalkIr {
213215
lifetime
214216
}
215217

218+
fn intern_const(&self, constant: ConstData<ChalkIr>) -> Arc<ConstData<ChalkIr>> {
219+
Arc::new(constant)
220+
}
221+
222+
fn const_data<'a>(&self, constant: &'a Arc<ConstData<ChalkIr>>) -> &'a ConstData<ChalkIr> {
223+
constant
224+
}
225+
226+
fn const_eq(&self, _ty: &Arc<TyData<ChalkIr>>, c1: &u32, c2: &u32) -> bool {
227+
c1 == c2
228+
}
229+
216230
fn intern_generic_arg(&self, generic_arg: GenericArgData<ChalkIr>) -> GenericArgData<ChalkIr> {
217231
generic_arg
218232
}

0 commit comments

Comments
 (0)