From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/chalk-engine/src/strand.rs | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 vendor/chalk-engine/src/strand.rs (limited to 'vendor/chalk-engine/src/strand.rs') diff --git a/vendor/chalk-engine/src/strand.rs b/vendor/chalk-engine/src/strand.rs new file mode 100644 index 000000000..91196ec94 --- /dev/null +++ b/vendor/chalk-engine/src/strand.rs @@ -0,0 +1,51 @@ +use crate::table::AnswerIndex; +use crate::{ExClause, TableIndex, TimeStamp}; +use std::fmt::Debug; + +use chalk_derive::HasInterner; +use chalk_ir::fold::{Fold, Folder}; +use chalk_ir::interner::Interner; +use chalk_ir::{Canonical, DebruijnIndex, UniverseMap}; + +#[derive(Clone, Debug, HasInterner)] +pub(crate) struct Strand { + pub(super) ex_clause: ExClause, + + /// Index into `ex_clause.subgoals`. + pub(crate) selected_subgoal: Option, + + pub(crate) last_pursued_time: TimeStamp, +} + +pub(crate) type CanonicalStrand = Canonical>; + +#[derive(Clone, Debug)] +pub(crate) struct SelectedSubgoal { + /// The index of the subgoal in `ex_clause.subgoals` + pub(crate) subgoal_index: usize, + + /// The index of the table that we created or found for this subgoal + pub(super) subgoal_table: TableIndex, + + /// Index of the answer we should request next from the table + pub(crate) answer_index: AnswerIndex, + + /// Maps the universes of the subgoal to the canonical universes + /// used in the table + pub(crate) universe_map: UniverseMap, +} + +impl Fold for Strand { + type Result = Strand; + fn fold_with( + self, + folder: &mut dyn Folder, + outer_binder: DebruijnIndex, + ) -> Result { + Ok(Strand { + ex_clause: self.ex_clause.fold_with(folder, outer_binder)?, + last_pursued_time: self.last_pursued_time, + selected_subgoal: self.selected_subgoal, + }) + } +} -- cgit v1.2.3