Memory safety without user-written lifetimes
Design goal: readable code with statically enforced ownership boundaries. This is not a claim that the present compiler has proven Rust-equivalent safety.
What single-thread ownership simplifies
A request-local value does not need to be Send or Sync when it never crosses a runtime thread. Local mutable state can avoid application-level Arc/Mutex. This removes some cross-thread coordination from user code. It does not establish a measurable “70% reduction” in complexity, eliminate all atomics, or guarantee a speedup.
What still needs rules
Lifetime checks are necessary even on one thread: aliases can outlive values, iterators can be invalidated, tasks can interleave, and I/O may continue using a buffer after the caller stops waiting. Pinning concerns address stability of self-referential futures; it is not solely about moving futures between threads. A compiler may hide pinning from users, but must implement the invariant.
The intended model has immutable values by default; mutation requires unique local ownership. No mutable borrow may cross a suspension point. Immutable request data may cross suspension only when its owner is proven to outlive both task and outstanding I/O. Structured child tasks must complete/cancel-and-join before region reset. Cross-core messages own their payload, and raw region references cannot cross the boundary.
“Never hold any reference across I/O” is a useful conservative first rule, but too broad as the final contract: efficient I/O needs owned or provably stable buffers across completion. We must distinguish a temporary mutable alias from an owned request buffer.
Value semantics/copy-on-write can simplify APIs, but introduce reference tracking, mutation-time copies and allocation costs. An arena handles allocation lifetime; it does not itself prevent aliasing errors or close files/sockets. Bounds checking, resource cleanup, cancellation and native-library audits remain independent requirements.
Cross-core lock-free SPSC queues generally use atomics to publish and consume messages. Lock-free is not “no atomics” or “no waiting”. One OS thread per core is a multi-threaded process with isolated application state; multiple processes offer a different crash-isolation boundary.
Current implementation
SDK 0.6.1 stores immutable strings as references into a request-owned arena and emits Rust lifetimes internally. Immutable records copy their scalar/nested-record values while retaining the arena lifetime of String fields. Optional values lower to Rust Option and preserve the same lifetime when present; absence is an explicit variant, not a user-accessible null pointer. Constructors require every field exactly once, evaluate each argument once in source order, and reject cyclic/excessive record shapes. Field mutation is unavailable; a mutable binding can replace the entire record. This deliberately restricted model does not expose raw pointers or mutable aliases.
The arena lives across handler suspension; on timeout/cancellation the handler future is dropped before the arena, and successful responses are copied into bounded output buffers. Native .one/TCP tests exercise values across suspension and record/JSON behavior. JSON decoding creates transient owned values and copies their strings into the arena; encoding stops at a bounded output writer. These operations are not zero-copy.
The current language has no user pointers, mutable record fields, collections, captured child tasks or globals. Optional scalar/record types are implemented, but nested Optional types and bounds-checked collections are not. Handling an Optional before field access or arithmetic is enforced by the compiler; equality with none does not introduce flow-sensitive narrowing. General copy-on-write, cross-request promotion and structured task ownership remain design work.
The 8 MiB per-request string budget is not a process-memory limit. Futures, sockets, transient JSON values, library allocations and Redis decoding are separate. Redis get/find values are checked against 1 MiB after decoding, so an oversized server response can allocate more than that before being rejected. Use trusted database endpoints. Recursive futures remain heap-allocated, and runtime recursion is not bounded by the record-shape limits. Compiler/native dependency bugs and process-aborting failures still need review and testing; this implementation is not a general memory-safety proof.