E1077: arena reference escapes its arena
A value that place puts in an arena is only valid while the arena lives (ADR-0030).
A value that place puts in an arena is only valid while the arena lives
(ADR-0030). A reference that is derived from the arena may not be stored in a
binding that outlives the arena's scope, and it may not be returned from the
verb, because the arena is released when its scope ends. The message names the
binding. The error points at the return or at the assignment. A value placed
in an arena the verb received as an ins parameter may not be returned or
stored into another ins parameter either: both outlive the call, and the
callee cannot see how long the caller keeps the arena (bug #81).
An arena that a verb creates is local to that verb (bug #143). Its storage is
part of the verb's frame, so the verb cannot return it, alone or inside a value
that holds it (a struct that owns it, an enum payload or an array), and cannot
store it into a place the caller owns, such as an ins parameter or a field of
one. The message names the arena, or the value that holds it, and says that it
is local to the verb. An arena received as an erg or dat parameter, or a
holder received that way, is the caller's storage and can be returned.
Example
Fix
Return or keep a plain value instead of the reference, for example the field that the caller needs. Move the arena to the scope that needs the data when the data must live longer.
An arena the caller owns can be handed back, because the caller gets its own storage:
Run actus explain E1077 in your terminal to read this entry offline. Browse Ownership & types or all error codes.