pub struct StackState { /* private fields */ }Expand description
State of the abstract stack during analysis
Implementations§
Source§impl StackState
impl StackState
pub fn new() -> Self
Sourcepub fn push_unknown(&mut self)
pub fn push_unknown(&mut self)
Push an unknown value onto the stack
Sourcepub fn push_resource(
&mut self,
kind: ResourceKind,
line: usize,
column: usize,
word: &str,
)
pub fn push_resource( &mut self, kind: ResourceKind, line: usize, column: usize, word: &str, )
Push a new tracked resource onto the stack
Sourcepub fn pop(&mut self) -> Option<StackValue>
pub fn pop(&mut self) -> Option<StackValue>
Pop a value from the stack
Sourcepub fn peek(&self) -> Option<&StackValue>
pub fn peek(&self) -> Option<&StackValue>
Peek at the top value without removing it
Sourcepub fn consume_resource(&mut self, resource: TrackedResource)
pub fn consume_resource(&mut self, resource: TrackedResource)
Mark a resource as consumed (properly cleaned up)
Sourcepub fn remaining_resources(&self) -> Vec<&TrackedResource>
pub fn remaining_resources(&self) -> Vec<&TrackedResource>
Get all resources still on the stack (potential leaks)
Sourcepub fn merge(&self, other: &StackState) -> BranchMergeResult
pub fn merge(&self, other: &StackState) -> BranchMergeResult
Merge two stack states (for branch unification) Returns resources that are leaked in one branch but not the other
Sourcepub fn join(&self, other: &StackState) -> StackState
pub fn join(&self, other: &StackState) -> StackState
Compute a lattice join of two stack states for continuation after branches.
The join is conservative:
- Resources present in EITHER branch are tracked (we don’t know which path was taken)
- Resources are only marked consumed if consumed in BOTH branches
- The next_id is taken from the max of both states
This ensures we don’t miss potential leaks from either branch.
Trait Implementations§
Source§impl Clone for StackState
impl Clone for StackState
Source§fn clone(&self) -> StackState
fn clone(&self) -> StackState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StackState
impl Debug for StackState
Auto Trait Implementations§
impl Freeze for StackState
impl RefUnwindSafe for StackState
impl Send for StackState
impl Sync for StackState
impl Unpin for StackState
impl UnwindSafe for StackState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more