Skip to content
REFERENCE

lifetime-too-short

Default severity: error · Identifier: weavec::lifetime-too-short

A pointer may outlive what it points to: '<p>' may outlive '<x>', which it points to (stored into an outer scope, a global or through a parameter) or returned pointer may outlive '<x>', which it points to. Notes: where <x> is declared and where it goes out of scope. Reported at the store, but decided when <x> dies (RFC 0011): a store undone before then (ls->fs = fs.prev), or into a holder that is dead by then, is not reported.

Ensure the referent lives at least as long as every pointer that escapes. Return a value, use caller-provided storage, or allocate storage with an ownership contract instead of returning an address into a local stack frame.

Diagnostic controls · Checked guarantees