Skip to content

Commit e0644c3

Browse files
committed
add const types
1 parent 351d2ec commit e0644c3

File tree

25 files changed

+408
-291
lines changed

25 files changed

+408
-291
lines changed

chalk-integration/src/interner.rs

Lines changed: 16 additions & 2 deletions
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-
AdtId, AliasTy, ApplicationTy, AssocTypeId, CanonicalVarKind, CanonicalVarKinds, Goals,
5-
Lifetime, OpaqueTy, OpaqueTyId, ProgramClauseImplication, ProgramClauses, ProjectionTy,
4+
AdtId, AliasTy, ApplicationTy, AssocTypeId, CanonicalVarKind, CanonicalVarKinds, ConstData,
5+
Goals, 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>>;
@@ -214,6 +216,18 @@ impl Interner for ChalkIr {
214216
lifetime
215217
}
216218

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

0 commit comments

Comments
 (0)