Struct cairo_lang_lowering::borrow_check::demand::Demand
source · pub struct Demand<Var: Hash + Eq + Copy> {
pub vars: OrderedHashSet<Var>,
}
Expand description
Demanded variables from a certain point in the flow until the end of the function. Needs to be updates in backwards order.
Fields§
§vars: OrderedHashSet<Var>
Implementations§
source§impl<Var: Hash + Eq + Copy> Demand<Var>
impl<Var: Hash + Eq + Copy> Demand<Var>
sourcepub fn finalize(self) -> bool
pub fn finalize(self) -> bool
Finalizes a demand. Returns a boolean representing success - if all the variable demands were satisfied.
sourcepub fn apply_remapping<V: Into<Var>, T: DemandReporter<Var>>(
&mut self,
reporter: &mut T,
remapping: impl Iterator<Item = (V, V)>
)
pub fn apply_remapping<V: Into<Var>, T: DemandReporter<Var>>( &mut self, reporter: &mut T, remapping: impl Iterator<Item = (V, V)> )
Updates the demand when a variable remapping occurs.
sourcepub fn variables_used<V: Copy + Into<Var>, T: DemandReporter<Var>>(
&mut self,
reporter: &mut T,
vars: &[V],
position: T::UsePosition
)
pub fn variables_used<V: Copy + Into<Var>, T: DemandReporter<Var>>( &mut self, reporter: &mut T, vars: &[V], position: T::UsePosition )
Updates the demand when some variables are used right before the current flow.
sourcepub fn variables_introduced<V: Copy + Into<Var>, T: DemandReporter<Var>>(
&mut self,
reporter: &mut T,
vars: &[V],
position: T::IntroducePosition
)
pub fn variables_introduced<V: Copy + Into<Var>, T: DemandReporter<Var>>( &mut self, reporter: &mut T, vars: &[V], position: T::IntroducePosition )
Updates the demand when some variables are introduced right before the current flow.
sourcepub fn merge_demands<T: DemandReporter<Var>>(
demands: &[(Self, T::IntroducePosition)],
reporter: &mut T
) -> Self
pub fn merge_demands<T: DemandReporter<Var>>( demands: &[(Self, T::IntroducePosition)], reporter: &mut T ) -> Self
Merges Demands from multiple branches into one, reporting diagnostics in the way.