rusty-capability-attr
Layer 2 (side-effect / capability safety) #[capability(...)] proc-macro
attribute for Rust: declares and enforces a function's allocation/IO/raw-pointer
scope at compile time, orthogonal to unsafe.
use capability;
// COMPILE ERROR: body allocates on the heap, but only `alloc(none)` was declared.
use capability;
// Compiles clean — every operation in the body is within what was declared.
unsafe remains the programmer's memory-safety promise (Layer 1, unchanged);
#[capability(...)] is the compiler's side-effect-scope promise layered on
top of it.
Part of the rusty workspace —
see the workspace README and
docs/aisecurity/capability-rfc-updated.md for full design background.
Licensed under Apache-2.0.