Skip to content

Commit c611d93

Browse files
committed
latest
1 parent 86ddbd8 commit c611d93

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

chalk-engine/src/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ pub trait Context: Clone + Debug {
172172
// Used by: simplify
173173
fn add_clauses(env: &Self::Environment, clauses: Self::ProgramClauses) -> Self::Environment;
174174

175-
/// Upcast this domain goal into a more general goal.
176-
fn into_goal(domain_goal: Self::DomainGoal) -> Self::Goal;
177-
178175
/// Selects the next appropriate subgoal index for evaluation.
179176
/// Used by: logic
180177
fn next_subgoal_index(ex_clause: &ExClause<Self>) -> usize;
@@ -265,6 +262,9 @@ pub trait ContextOps<C: Context>: Sized + Clone + Debug + AggregateOps<C> {
265262
) -> C::CanonicalAnswerSubst;
266263

267264
fn interner(&self) -> &C::Interner;
265+
266+
/// Upcast this domain goal into a more general goal.
267+
fn into_goal(&self, domain_goal: C::DomainGoal) -> C::Goal;
268268
}
269269

270270
/// Methods for combining solutions to yield an aggregate solution.

chalk-solve/src/infer/unify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'t, I: Interner> Unifier<'t, I> {
260260

261261
self.table
262262
.unify
263-
.unify_var_value(var, InferenceValue::from(ty1.clone()))
263+
.unify_var_value(var, InferenceValue::from_ty(self.interner, ty1.clone()))
264264
.unwrap();
265265
debug!("unify_var_ty: var {:?} set to {:?}", var, ty1);
266266

@@ -300,7 +300,7 @@ impl<'t, I: Interner> Unifier<'t, I> {
300300
let v = LifetimeData::Placeholder(idx).intern(self.interner);
301301
self.table
302302
.unify
303-
.unify_var_value(var, InferenceValue::from(v))
303+
.unify_var_value(var, InferenceValue::from_lifetime(self.interner, v))
304304
.unwrap();
305305
Ok(())
306306
} else {

chalk-solve/src/infer/var.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ pub(crate) enum InferenceValue<I: Interner> {
9292
}
9393

9494
impl<I: Interner> InferenceValue<I> {
95-
fn from(interner: &I, lifetime: Lifetime<I>) -> Self {
95+
pub fn from_ty(interner: &I, ty: Ty<I>) -> Self {
96+
InferenceValue::Bound(ty.cast(interner))
97+
}
98+
99+
pub fn from_lifetime(interner: &I, lifetime: Lifetime<I>) -> Self {
96100
InferenceValue::Bound(lifetime.cast(interner))
97101
}
98102
}

chalk-solve/src/solve/slg.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ impl<I: Interner> context::Context for SlgContext<I> {
167167
Environment::add_clauses(env, clauses)
168168
}
169169

170-
fn into_goal(domain_goal: DomainGoal<I>) -> Goal<I> {
171-
domain_goal.cast()
172-
}
173-
174170
// Used by: logic
175171
fn next_subgoal_index(ex_clause: &ExClause<SlgContext<I>>) -> usize {
176172
// For now, we always pick the last subgoal in the
@@ -334,6 +330,11 @@ impl<'me, I: Interner> context::ContextOps<SlgContext<I>> for SlgContextOps<'me,
334330
fn interner(&self) -> &I {
335331
self.program.interner()
336332
}
333+
334+
fn into_goal(&self, domain_goal: DomainGoal<I>) -> Goal<I> {
335+
domain_goal.cast(self.program.interner())
336+
}
337+
337338
}
338339

339340
impl<I: Interner> TruncatingInferenceTable<I> {

0 commit comments

Comments
 (0)