Skip to content

Commit 1a41931

Browse files
authored
Merge pull request #348 from yaahc/jane/intern-substitution
Add self param to intern_substitution
2 parents 4895b95 + dab6a15 commit 1a41931

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

chalk-ir/src/interner.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ pub trait Interner: Debug + Copy + Eq + Ord + Hash {
171171
/// normally invoked directly; instead, you invoke
172172
/// `GoalsData::intern` (which will ultimately call this
173173
/// method).
174-
fn intern_goals(data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals;
174+
fn intern_goals(&self, data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals;
175175

176176
/// Lookup the `GoalsData` that was interned to create a `InternedGoals`.
177177
fn goals_data(goals: &Self::InternedGoals) -> &[Goal<Self>];
@@ -181,6 +181,7 @@ pub trait Interner: Debug + Copy + Eq + Ord + Hash {
181181
/// `SubstitutionData::intern` (which will ultimately call this
182182
/// method).
183183
fn intern_substitution<E>(
184+
&self,
184185
data: impl IntoIterator<Item = Result<Parameter<Self>, E>>,
185186
) -> Result<Self::InternedSubstitution, E>;
186187

@@ -303,7 +304,10 @@ mod default {
303304
goal
304305
}
305306

306-
fn intern_goals(data: impl IntoIterator<Item = Goal<ChalkIr>>) -> Vec<Goal<ChalkIr>> {
307+
fn intern_goals(
308+
&self,
309+
data: impl IntoIterator<Item = Goal<ChalkIr>>,
310+
) -> Vec<Goal<ChalkIr>> {
307311
data.into_iter().collect()
308312
}
309313

@@ -312,6 +316,7 @@ mod default {
312316
}
313317

314318
fn intern_substitution<E>(
319+
&self,
315320
data: impl IntoIterator<Item = Result<Parameter<ChalkIr>, E>>,
316321
) -> Result<Vec<Parameter<ChalkIr>>, E> {
317322
data.into_iter().collect()

chalk-ir/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ impl<I: Interner> Goals<I> {
10311031
pub fn from(interner: &I, goals: impl IntoIterator<Item = impl CastTo<Goal<I>>>) -> Self {
10321032
use crate::cast::Caster;
10331033
Goals {
1034-
goals: I::intern_goals(goals.into_iter().casted(interner)),
1034+
goals: I::intern_goals(interner, goals.into_iter().casted(interner)),
10351035
}
10361036
}
10371037

@@ -1248,7 +1248,7 @@ impl<I: Interner> Substitution<I> {
12481248
) -> Result<Self, E> {
12491249
use crate::cast::Caster;
12501250
Ok(Substitution {
1251-
parameters: I::intern_substitution(parameters.into_iter().casted(interner))?,
1251+
parameters: I::intern_substitution(interner, parameters.into_iter().casted(interner))?,
12521252
})
12531253
}
12541254

0 commit comments

Comments
 (0)