]> git.lizzy.rs Git - rust.git/commitdiff
Implement `InferenceTable::add_clauses`
authorscalexm <alexandre@scalexm.fr>
Sat, 13 Oct 2018 14:29:21 +0000 (16:29 +0200)
committerscalexm <alexandre@scalexm.fr>
Wed, 17 Oct 2018 12:09:39 +0000 (14:09 +0200)
src/librustc_traits/chalk_context.rs

index 2fd8aa0c3af350cfeb43209a401862fa527d2362..371fa46f3701039f8dbd2273c132245f80fa0ba8 100644 (file)
@@ -22,7 +22,7 @@
     ExClauseLift,
     Goal,
     GoalKind,
-    ProgramClause,
+    Clause,
     QuantifierKind,
     Environment,
     InEnvironment,
@@ -100,9 +100,9 @@ impl context::Context for ChalkArenas<'tcx> {
 
     type Parameter = Kind<'tcx>;
 
-    type ProgramClause = ProgramClause<'tcx>;
+    type ProgramClause = Clause<'tcx>;
 
-    type ProgramClauses = Vec<ProgramClause<'tcx>>;
+    type ProgramClauses = Vec<Clause<'tcx>>;
 
     type UnificationResult = InferOk<'tcx, ()>;
 
@@ -272,10 +272,14 @@ fn into_hh_goal(&mut self, goal: Goal<'tcx>) -> ChalkHhGoal<'tcx> {
 
     fn add_clauses(
         &mut self,
-        _env: &Environment<'tcx>,
-        _clauses: Vec<ProgramClause<'tcx>>,
+        env: &Environment<'tcx>,
+        clauses: Vec<Clause<'tcx>>,
     ) -> Environment<'tcx> {
-        panic!("FIXME no method to add clauses to Environment yet")
+        Environment {
+            clauses: self.infcx.tcx.mk_clauses(
+                env.clauses.iter().cloned().chain(clauses.into_iter())
+            )
+        }
     }
 }
 
@@ -287,7 +291,7 @@ fn resolvent_clause(
         _environment: &Environment<'tcx>,
         _goal: &DomainGoal<'tcx>,
         _subst: &CanonicalVarValues<'tcx>,
-        _clause: &ProgramClause<'tcx>,
+        _clause: &Clause<'tcx>,
     ) -> chalk_engine::fallible::Fallible<Canonical<'gcx, ChalkExClause<'gcx>>> {
         panic!()
     }
@@ -328,7 +332,7 @@ fn program_clauses(
         &self,
         _environment: &Environment<'tcx>,
         goal: &DomainGoal<'tcx>,
-    ) -> Vec<ProgramClause<'tcx>> {
+    ) -> Vec<Clause<'tcx>> {
         use rustc::traits::WhereClause::*;
 
         match goal {