pub struct EffectEnv { /* private fields */ }Expand description
Environment tracking effects for variables and functions.
For each variable binding (Let x be <expr>), tracks the EffectSet
of the bound expression. For each function, tracks the aggregate
EffectSet of its body.
Implementations§
Source§impl EffectEnv
impl EffectEnv
Sourcepub fn from_stmts(stmts: &[Stmt<'_>], interner: &Interner) -> Self
pub fn from_stmts(stmts: &[Stmt<'_>], interner: &Interner) -> Self
Analyze already-parsed statements and return the EffectEnv.
Sourcepub fn analyze_source(source: &str) -> Result<Self, ParseError>
pub fn analyze_source(source: &str) -> Result<Self, ParseError>
Analyze a complete LOGOS source and return the EffectEnv.
pub fn is_binding_pure(&self, var_name: &str) -> bool
pub fn binding_reads(&self, var_name: &str, read_var: &str) -> bool
pub fn binding_allocates(&self, var_name: &str) -> bool
pub fn has_write_to(&self, var_name: &str) -> bool
pub fn has_io(&self) -> bool
pub fn has_unknown(&self) -> bool
pub fn has_security_check(&self) -> bool
pub fn may_diverge(&self) -> bool
pub fn function_is_pure(&self, fn_name: &str) -> bool
pub fn function_has_io(&self, fn_name: &str) -> bool
Sourcepub fn function_is_specialization_safe(&self, fn_name: &str) -> bool
pub fn function_is_specialization_safe(&self, fn_name: &str) -> bool
Whether the partial evaluator may specialize a call to fn_name on a static
argument. Reads, writes, allocation, and divergence are ordinary PE targets and
stay safe. IO already blocks specialization (the historical gate). Nondeterminism
and concurrency are the new exclusions: a concurrency / networking statement carries
expression arguments (a timeout, spawn args, a branch body) that reference the
static parameter, and the specializer’s substitution does not enter those
statements — folding across one would drop the parameter and leave a dangling
reference. A Check (security_check) is deliberately not excluded: it is preserved
verbatim and never references a foldable parameter, so specializing across it is
sound (see pe_effect_env_check_is_not_io). Escape blocks (unknown) are handled by
the caller’s separate body_has_escape guard.
Auto Trait Implementations§
impl Freeze for EffectEnv
impl RefUnwindSafe for EffectEnv
impl Send for EffectEnv
impl Sync for EffectEnv
impl Unpin for EffectEnv
impl UnsafeUnpin for EffectEnv
impl UnwindSafe for EffectEnv
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.