fn pursue_strand(
        &mut self,
        depth: StackIndex,
        mut strand: Strand<'_, C, impl Context>,
    ) -> StrandResult<C, ()> {
        info_heading!(
            "pursue_strand(table={:?}, depth={:?}, ex_clause={:#?}, selected_subgoal={:?})",
            self.stack[depth].table,
            depth,
            strand.infer.debug_ex_clause(&strand.ex_clause),
            strand.selected_subgoal,
        );

        // If no subgoal has yet been selected, select one.
        while strand.selected_subgoal.is_none() {
            if strand.ex_clause.subgoals.len() == 0 {
                return self.pursue_answer(depth, strand);
            }

            // For now, we always pick the last subgoal in the
            // list.
            //
            // FIXME(rust-lang-nursery/chalk#80) -- we should be more
            // selective. For example, we don't want to pick a
            // negative literal that will flounder, and we don't want
            // to pick things like `?T: Sized` if we can help it.
            let subgoal_index = strand.ex_clause.subgoals.len() - 1;

            // Get or create table for this subgoal.
            match self.get_or_create_table_for_subgoal(
                &mut *strand.infer,
                &strand.ex_clause.subgoals[subgoal_index],
            ) {
                Some((subgoal_table, universe_map)) => {
                    strand.selected_subgoal = Some(SelectedSubgoal {
                        subgoal_index,
                        subgoal_table,
                        universe_map,
                        answer_index: AnswerIndex::ZERO,
                    });
                }

                None => {
                    // If we failed to create a table for the subgoal,
                    // then the execution has "floundered" (cannot yield
                    // a complete result). We choose to handle this by
                    // removing the subgoal and inserting a
                    // `CannotProve` result. This can only happen with
                    // ill-formed negative literals or with overflow.
                    strand.ex_clause.subgoals.remove(subgoal_index);
                    strand
                        .ex_clause
                        .delayed_literals
                        .push(DelayedLiteral::CannotProve(()));
                }
            }
        }

        // Find the selected subgoal and ask it for the next answer.
        let selected_subgoal = strand.selected_subgoal.clone().unwrap();
        match strand.ex_clause.subgoals[selected_subgoal.subgoal_index] {
            Literal::Positive(_) => self.pursue_positive_subgoal(depth, strand, &selected_subgoal),
            Literal::Negative(_) => self.pursue_negative_subgoal(depth, strand, &selected_subgoal),
        }
    }
/// Pursues `strand` to see if it leads us to a new answer, either
/// by selecting a new subgoal or by checking to see if the
/// selected subgoal has an answer. `strand` is associated with
/// the table on the stack at the given `depth`.
Pursues `strand` to see if it leads us to a new answer, either
by selecting a new subgoal or by checking to see if the
selected subgoal has an answer. `strand` is associated with
the table on the stack at the given `depth`.
Pursues ` strand ` to see if it leads us to a new answer either by selecting a new subgoal or by checking to see if the selected subgoal has an answer . ` strand ` is associated with the table on the stack at the given ` depth ` .
fn pursue_strand(
        &mut self,
        depth: StackIndex,
        mut strand: Strand<'_, C, impl Context>,
    ) -> StrandResult<C, ()> {
        info_heading!(
            "pursue_strand(table={:?}, depth={:?}, ex_clause={:#?}, selected_subgoal={:?})",
            self.stack[depth].table,
            depth,
            strand.infer.debug_ex_clause(&strand.ex_clause),
            strand.selected_subgoal,
        );
        // If no subgoal has yet been selected, select one.
        while strand.selected_subgoal.is_none() {
            if strand.ex_clause.subgoals.len() == 0 {
                return self.pursue_answer(depth, strand);
            }
            // For now, we always pick the last subgoal in the
            // list.
            //
            // FIXME(rust-lang-nursery/chalk#80) -- we should be more
            // selective. For example, we don't want to pick a
            // negative literal that will flounder, and we don't want
            // to pick things like `?T: Sized` if we can help it.
            let subgoal_index = strand.ex_clause.subgoals.len() - 1;
            // Get or create table for this subgoal.
            match self.get_or_create_table_for_subgoal(
                &mut *strand.infer,
                &strand.ex_clause.subgoals[subgoal_index],
            ) {
                Some((subgoal_table, universe_map)) => {
                    strand.selected_subgoal = Some(SelectedSubgoal {
                        subgoal_index,
                        subgoal_table,
                        universe_map,
                        answer_index: AnswerIndex::ZERO,
                    });
                }
                None => {
                    // If we failed to create a table for the subgoal,
                    // then the execution has "floundered" (cannot yield
                    // a complete result). We choose to handle this by
                    // removing the subgoal and inserting a
                    // `CannotProve` result. This can only happen with
                    // ill-formed negative literals or with overflow.
                    strand.ex_clause.subgoals.remove(subgoal_index);
                    strand
                        .ex_clause
                        .delayed_literals
                        .push(DelayedLiteral::CannotProve(()));
                }
            }
        }
        // Find the selected subgoal and ask it for the next answer.
        let selected_subgoal = strand.selected_subgoal.clone().unwrap();
        match strand.ex_clause.subgoals[selected_subgoal.subgoal_index] {
            Literal::Positive(_) => self.pursue_positive_subgoal(depth, strand, &selected_subgoal),
            Literal::Negative(_) => self.pursue_negative_subgoal(depth, strand, &selected_subgoal),
        }
    }
fn pursue_strand ( & mut self , depth : StackIndex , mut strand : Strand < ' _ , C , impl Context > , ) -> StrandResult < C , ( ) > { info_heading ! ( " " self stack [ depth ] table depth strand infer debug_ex_clause ( strand ex_clause ) strand selected_subgoal ) ; // If no subgoal has yet been selected, select one. while strand . selected_subgoal . is_none ( ) { if strand . ex_clause . subgoals . len ( ) == 0 { return self . pursue_answer ( depth , strand ) ; } // For now, we always pick the last subgoal in the // list. // // FIXME(rust-lang-nursery/chalk#80) -- we should be more // selective. For example, we don't want to pick a // negative literal that will flounder, and we don't want // to pick things like `?T: Sized` if we can help it. let subgoal_index = strand . ex_clause . subgoals . len ( ) - 1 ; // Get or create table for this subgoal. match self . get_or_create_table_for_subgoal ( & mut * strand . infer , & strand . ex_clause . subgoals [ subgoal_index ] , ) { Some ( ( subgoal_table , universe_map ) ) => { strand . selected_subgoal = Some ( SelectedSubgoal { subgoal_index , subgoal_table , universe_map , answer_index : AnswerIndex :: ZERO , } ) ; } None => { // If we failed to create a table for the subgoal, // then the execution has "floundered" (cannot yield // a complete result). We choose to handle this by // removing the subgoal and inserting a // `CannotProve` result. This can only happen with // ill-formed negative literals or with overflow. strand . ex_clause . subgoals . remove ( subgoal_index ) ; strand . ex_clause . delayed_literals . push ( DelayedLiteral :: CannotProve ( ( ) ) ) ; } } } // Find the selected subgoal and ask it for the next answer. let selected_subgoal = strand . selected_subgoal . clone ( ) . unwrap ( ) ; match strand . ex_clause . subgoals [ selected_subgoal . subgoal_index ] { Literal :: Positive ( _ ) => self . pursue_positive_subgoal ( depth , strand , & selected_subgoal ) , Literal :: Negative ( _ ) => self . pursue_negative_subgoal ( depth , strand , & selected_subgoal ) , } }
Pursues `strand` to see if it leads us to a new answer, either
by selecting a new subgoal or by checking to see if the
selected subgoal has an answer.
Pursues ` strand ` to see if it leads us to a new answer either by selecting a new subgoal or by checking to see if the selected subgoal has an answer .
&mut self
depth
StackIndex
strand
Strand<'_, C, impl Context>
&mut self
depth
StackIndex
strand
Strand<'_, C, impl Context>