pub struct ScopedLifetimeTracker { /* private fields */ }Expand description
Tracks lifetimes with respect to program scopes
Implementations§
Source§impl ScopedLifetimeTracker
impl ScopedLifetimeTracker
pub fn new() -> Self
Sourcepub fn push_scope(&mut self, kind: ScopeKind, parent: Option<usize>) -> usize
pub fn push_scope(&mut self, kind: ScopeKind, parent: Option<usize>) -> usize
Create a new scope
Sourcepub fn declare_variable(&mut self, var: String, scope_id: usize)
pub fn declare_variable(&mut self, var: String, scope_id: usize)
Add a variable to the current scope
Sourcepub fn declare_reference(&mut self, ref_name: String, scope_id: usize)
pub fn declare_reference(&mut self, ref_name: String, scope_id: usize)
Add a reference to the current scope
Sourcepub fn check_outlives(&self, longer: &str, shorter: &str) -> bool
pub fn check_outlives(&self, longer: &str, shorter: &str) -> bool
Check if a lifetime outlives another considering scopes
Sourcepub fn is_alive_in_scope(&self, var: &str, scope_id: usize) -> bool
pub fn is_alive_in_scope(&self, var: &str, scope_id: usize) -> bool
Check if a variable is still alive in a given scope
Sourcepub fn add_constraint(&mut self, constraint: LifetimeConstraint)
pub fn add_constraint(&mut self, constraint: LifetimeConstraint)
Add a lifetime constraint
Sourcepub fn validate_constraints(&self) -> Vec<String>
pub fn validate_constraints(&self) -> Vec<String>
Validate all lifetime constraints
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScopedLifetimeTracker
impl RefUnwindSafe for ScopedLifetimeTracker
impl Send for ScopedLifetimeTracker
impl Sync for ScopedLifetimeTracker
impl Unpin for ScopedLifetimeTracker
impl UnwindSafe for ScopedLifetimeTracker
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