|
1 |
| -use crate::{DelayedLiteral, DelayedLiteralSet, DepthFirstNumber, ExClause, Literal, Minimums, |
2 |
| - TableIndex}; |
| 1 | +use crate::context::{prelude::*, WithInstantiatedExClause, WithInstantiatedUCanonicalGoal}; |
3 | 2 | use crate::fallible::NoSolution;
|
4 |
| -use crate::context::{WithInstantiatedExClause, WithInstantiatedUCanonicalGoal, prelude::*}; |
5 | 3 | use crate::forest::Forest;
|
6 | 4 | use crate::hh::HhGoal;
|
7 | 5 | use crate::stack::StackIndex;
|
8 | 6 | use crate::strand::{CanonicalStrand, SelectedSubgoal, Strand};
|
9 | 7 | use crate::table::{Answer, AnswerIndex};
|
| 8 | +use crate::{ |
| 9 | + DelayedLiteral, DelayedLiteralSet, DepthFirstNumber, ExClause, Literal, Minimums, TableIndex, |
| 10 | +}; |
10 | 11 | use rustc_hash::FxHashSet;
|
11 | 12 | use std::marker::PhantomData;
|
12 | 13 | use std::mem;
|
@@ -117,7 +118,9 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
|
117 | 118 | }
|
118 | 119 |
|
119 | 120 | self.tables[table].strands_mut().any(|strand| {
|
120 |
| - test(CO::inference_normalized_subst_from_ex_clause(&strand.canonical_ex_clause)) |
| 121 | + test(CO::inference_normalized_subst_from_ex_clause( |
| 122 | + &strand.canonical_ex_clause, |
| 123 | + )) |
121 | 124 | })
|
122 | 125 | }
|
123 | 126 |
|
@@ -291,7 +294,8 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
|
291 | 294 | }
|
292 | 295 |
|
293 | 296 | impl<C: Context, CO: ContextOps<C>, OP: WithInstantiatedStrand<C, CO>>
|
294 |
| - WithInstantiatedExClause<C> for With<C, CO, OP> { |
| 297 | + WithInstantiatedExClause<C> for With<C, CO, OP> |
| 298 | + { |
295 | 299 | type Output = OP::Output;
|
296 | 300 |
|
297 | 301 | fn with<I: Context>(
|
@@ -401,7 +405,11 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
|
401 | 405 | /// encounters a cycle, and that some of those cycles involve
|
402 | 406 | /// negative edges. In that case, walks all negative edges and
|
403 | 407 | /// converts them to delayed literals.
|
404 |
| - fn delay_strands_after_cycle(&mut self, table: TableIndex, visited: &mut FxHashSet<TableIndex>) { |
| 408 | + fn delay_strands_after_cycle( |
| 409 | + &mut self, |
| 410 | + table: TableIndex, |
| 411 | + visited: &mut FxHashSet<TableIndex>, |
| 412 | + ) { |
405 | 413 | let mut tables = vec![];
|
406 | 414 |
|
407 | 415 | let num_universes = CO::num_universes(&self.tables[table].table_goal);
|
@@ -562,7 +570,8 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
|
562 | 570 | debug!("answer: table={:?}, answer_subst={:?}", table, answer_subst);
|
563 | 571 |
|
564 | 572 | let delayed_literals = {
|
565 |
| - let delayed_literals: FxHashSet<_> = delayed_literals.into_iter() |
| 573 | + let delayed_literals: FxHashSet<_> = delayed_literals |
| 574 | + .into_iter() |
566 | 575 | .map(|dl| infer.lift_delayed_literal(dl))
|
567 | 576 | .collect();
|
568 | 577 | DelayedLiteralSet { delayed_literals }
|
@@ -739,7 +748,8 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
|
739 | 748 | }
|
740 | 749 |
|
741 | 750 | impl<C: Context, CO: ContextOps<C>> WithInstantiatedUCanonicalGoal<C>
|
742 |
| - for PushInitialStrandsInstantiated<'a, C, CO> { |
| 751 | + for PushInitialStrandsInstantiated<'a, C, CO> |
| 752 | + { |
743 | 753 | type Output = ();
|
744 | 754 |
|
745 | 755 | fn with<I: Context>(
|
@@ -1052,10 +1062,14 @@ impl<C: Context, CO: ContextOps<C>> Forest<C, CO> {
|
1052 | 1062 | ),
|
1053 | 1063 | };
|
1054 | 1064 |
|
1055 |
| - let table_goal = &CO::map_goal_from_canonical(&universe_map, |
1056 |
| - &CO::canonical(&self.tables[subgoal_table].table_goal)); |
1057 |
| - let answer_subst = |
1058 |
| - &CO::map_subst_from_canonical(&universe_map, &self.answer(subgoal_table, answer_index).subst); |
| 1065 | + let table_goal = &CO::map_goal_from_canonical( |
| 1066 | + &universe_map, |
| 1067 | + &CO::canonical(&self.tables[subgoal_table].table_goal), |
| 1068 | + ); |
| 1069 | + let answer_subst = &CO::map_subst_from_canonical( |
| 1070 | + &universe_map, |
| 1071 | + &self.answer(subgoal_table, answer_index).subst, |
| 1072 | + ); |
1059 | 1073 | match infer.apply_answer_subst(ex_clause, &subgoal, table_goal, answer_subst) {
|
1060 | 1074 | Ok(mut ex_clause) => {
|
1061 | 1075 | // If the answer had delayed literals, we have to
|
|
0 commit comments