Skip to content

Commit

Permalink
add const types
Browse files Browse the repository at this point in the history
  • Loading branch information
basil-cow committed May 15, 2020
1 parent cf495e4 commit 34abc6f
Show file tree
Hide file tree
Showing 23 changed files with 379 additions and 278 deletions.
18 changes: 16 additions & 2 deletions chalk-integration/src/interner.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::tls;
use chalk_ir::interner::{HasInterner, Interner};
use chalk_ir::{
AliasTy, ApplicationTy, AssocTypeId, CanonicalVarKind, CanonicalVarKinds, Goals, Lifetime,
OpaqueTy, OpaqueTyId, ProgramClauseImplication, ProgramClauses, ProjectionTy,
AliasTy, ApplicationTy, AssocTypeId, CanonicalVarKind, CanonicalVarKinds, ConstData, Goals,
Lifetime, OpaqueTy, OpaqueTyId, ProgramClauseImplication, ProgramClauses, ProjectionTy,
QuantifiedWhereClauses, SeparatorTraitRef, Substitution, TraitId, Ty, VariableKind,
VariableKinds,
};
Expand Down Expand Up @@ -36,6 +36,8 @@ pub struct ChalkIr;
impl Interner for ChalkIr {
type InternedType = Arc<TyData<ChalkIr>>;
type InternedLifetime = LifetimeData<ChalkIr>;
type InternedConst = Arc<ConstData<ChalkIr>>;
type InternedConcreteConst = u32;
type InternedGenericArg = GenericArgData<ChalkIr>;
type InternedGoal = Arc<GoalData<ChalkIr>>;
type InternedGoals = Vec<Goal<ChalkIr>>;
Expand Down Expand Up @@ -213,6 +215,18 @@ impl Interner for ChalkIr {
lifetime
}

fn intern_const(&self, constant: ConstData<ChalkIr>) -> Arc<ConstData<ChalkIr>> {
Arc::new(constant)
}

fn const_data<'a>(&self, constant: &'a Arc<ConstData<ChalkIr>>) -> &'a ConstData<ChalkIr> {
constant
}

fn const_eq(&self, _ty: &Arc<TyData<ChalkIr>>, c1: &u32, c2: &u32) -> bool {
c1 == c2
}

fn intern_generic_arg(&self, generic_arg: GenericArgData<ChalkIr>) -> GenericArgData<ChalkIr> {
generic_arg
}
Expand Down
Loading

0 comments on commit 34abc6f

Please sign in to comment.