@@ -909,14 +909,9 @@ impl<'forest, C: Context + 'forest, CO: ContextOps<C> + 'forest> SolveState<'for
909909 // we might have to build on it (see the
910910 // Delayed Trivial Self Cycle, Variant 3
911911 // example).
912- let ( _, _, _, table_goal) = self
913- . context
914- . instantiate_ucanonical_goal ( & self . forest . tables [ table] . table_goal ) ;
915912
916913 let answer = self . forest . answer ( table, answer_index) ;
917- if let Some ( strand) =
918- self . create_refinement_strand ( table, answer, table_goal)
919- {
914+ if let Some ( strand) = self . create_refinement_strand ( table, answer) {
920915 self . forest . tables [ table] . enqueue_strand ( strand) ;
921916 }
922917
@@ -964,7 +959,6 @@ impl<'forest, C: Context + 'forest, CO: ContextOps<C> + 'forest> SolveState<'for
964959 & self ,
965960 table : TableIndex ,
966961 answer : & Answer < C > ,
967- table_goal : C :: Goal ,
968962 ) -> Option < CanonicalStrand < C > > {
969963 // If there are no delayed subgoals, then there is no need for
970964 // a refinement strand.
@@ -977,16 +971,8 @@ impl<'forest, C: Context + 'forest, CO: ContextOps<C> + 'forest> SolveState<'for
977971 . context
978972 . instantiate_answer_subst ( num_universes, & answer. subst ) ;
979973
980- // FIXME: it would be nice if these delayed subgoals didn't get added to the answer
981- // at all. However, we can't compare the delayed subgoals with the table goal until
982- // we call `canonicalize_answer_subst` in `pursue_answer`. However, at this point,
983- // it's a bit late since `pursue_answer` doesn't know about the table goal. This could
984- // be refactored a bit.
985- let filtered_delayed_subgoals = delayed_subgoals
974+ let delayed_subgoals = delayed_subgoals
986975 . into_iter ( )
987- . filter ( |delayed_subgoal| {
988- * C :: goal_from_goal_in_environment ( delayed_subgoal) != table_goal
989- } )
990976 . map ( Literal :: Positive )
991977 . collect ( ) ;
992978
@@ -996,7 +982,7 @@ impl<'forest, C: Context + 'forest, CO: ContextOps<C> + 'forest> SolveState<'for
996982 subst,
997983 ambiguous : answer. ambiguous ,
998984 constraints,
999- subgoals : filtered_delayed_subgoals ,
985+ subgoals : delayed_subgoals ,
1000986 delayed_subgoals : Vec :: new ( ) ,
1001987 answer_time : TimeStamp :: default ( ) ,
1002988 floundered_subgoals : Vec :: new ( ) ,
@@ -1328,11 +1314,23 @@ impl<'forest, C: Context + 'forest, CO: ContextOps<C> + 'forest> SolveState<'for
13281314 return None ;
13291315 }
13301316
1317+ let table_goal = & self . forest . tables [ table] . table_goal ;
1318+
1319+ //FIXME: Avoid double canonicalization
1320+ let filtered_delayed_subgoals = delayed_subgoals
1321+ . into_iter ( )
1322+ . filter ( |delayed_subgoal| {
1323+ let ( canonicalized, _) =
1324+ infer. fully_canonicalize_goal ( self . context . interner ( ) , delayed_subgoal) ;
1325+ * table_goal != canonicalized
1326+ } )
1327+ . collect ( ) ;
1328+
13311329 let subst = infer. canonicalize_answer_subst (
13321330 self . context . interner ( ) ,
13331331 subst,
13341332 constraints,
1335- delayed_subgoals ,
1333+ filtered_delayed_subgoals ,
13361334 ) ;
13371335 debug ! ( "answer: table={:?}, subst={:?}" , table, subst) ;
13381336
0 commit comments