pub struct ParamAttrs {
pub readonly: bool,
pub nocapture: bool,
}Expand description
Per-parameter pointer attributes, LLVM-style, inferred (or read from a C prototype) and consumed at call sites to relax the default “every pointer argument aliases everything and is written through by the callee” assumption.
The two bits are deliberately independent: readonly proves only that the
callee does not write through the pointer during this call, which is enough
to stop a call from clobbering the cells the argument reaches (see
mem_forward’s call-kill). It does not prove the pointer is safe to reason
about across the call: a captured pointer can be written through later, so
frame-freshness reasoning additionally requires nocapture. Both bits default
to false (fully conservative); an inference/extern pass sets them.
Fields§
§readonly: boolThe callee never writes through this pointer parameter (C *const
semantics, one level deep: a store through a pointer loaded from the
param does not clear this — only stores whose address is affine-derived
from the param itself do).
nocapture: boolThe callee does not retain this pointer beyond the call, except by returning it (capture-by-return does not clear this: the returned pointer is still tracked by the caller, so it is not an unbounded escape).
Implementations§
Source§impl ParamAttrs
impl ParamAttrs
Sourcepub const OPTIMISTIC: Self
pub const OPTIMISTIC: Self
The fully permissive attribute set (both bits): the optimistic starting point of the bottom-up inference fixpoint, whittled down as the body walk finds writes/captures/escapes.
Trait Implementations§
Source§impl Clone for ParamAttrs
impl Clone for ParamAttrs
Source§fn clone(&self) -> ParamAttrs
fn clone(&self) -> ParamAttrs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more