Skip to content

Commit 7ec8269

Browse files
committed
Implement InferenceTable::add_clauses
1 parent b5d1aac commit 7ec8269

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/librustc_traits/chalk_context.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use rustc::traits::{
2222
ExClauseLift,
2323
Goal,
2424
GoalKind,
25-
ProgramClause,
25+
Clause,
2626
QuantifierKind,
2727
Environment,
2828
InEnvironment,
@@ -100,9 +100,9 @@ impl context::Context for ChalkArenas<'tcx> {
100100

101101
type Parameter = Kind<'tcx>;
102102

103-
type ProgramClause = ProgramClause<'tcx>;
103+
type ProgramClause = Clause<'tcx>;
104104

105-
type ProgramClauses = Vec<ProgramClause<'tcx>>;
105+
type ProgramClauses = Vec<Clause<'tcx>>;
106106

107107
type UnificationResult = InferOk<'tcx, ()>;
108108

@@ -272,10 +272,14 @@ impl context::InferenceTable<ChalkArenas<'gcx>, ChalkArenas<'tcx>>
272272

273273
fn add_clauses(
274274
&mut self,
275-
_env: &Environment<'tcx>,
276-
_clauses: Vec<ProgramClause<'tcx>>,
275+
env: &Environment<'tcx>,
276+
clauses: Vec<Clause<'tcx>>,
277277
) -> Environment<'tcx> {
278-
panic!("FIXME no method to add clauses to Environment yet")
278+
Environment {
279+
clauses: self.infcx.tcx.mk_clauses(
280+
env.clauses.iter().cloned().chain(clauses.into_iter())
281+
)
282+
}
279283
}
280284
}
281285

@@ -287,7 +291,7 @@ impl context::ResolventOps<ChalkArenas<'gcx>, ChalkArenas<'tcx>>
287291
_environment: &Environment<'tcx>,
288292
_goal: &DomainGoal<'tcx>,
289293
_subst: &CanonicalVarValues<'tcx>,
290-
_clause: &ProgramClause<'tcx>,
294+
_clause: &Clause<'tcx>,
291295
) -> chalk_engine::fallible::Fallible<Canonical<'gcx, ChalkExClause<'gcx>>> {
292296
panic!()
293297
}
@@ -328,7 +332,7 @@ impl context::UnificationOps<ChalkArenas<'gcx>, ChalkArenas<'tcx>>
328332
&self,
329333
_environment: &Environment<'tcx>,
330334
goal: &DomainGoal<'tcx>,
331-
) -> Vec<ProgramClause<'tcx>> {
335+
) -> Vec<Clause<'tcx>> {
332336
use rustc::traits::WhereClause::*;
333337

334338
match goal {

0 commit comments

Comments
 (0)