S0059: function cannot return Shared handle
Generated from rellum-diagnostics/src/db.rs.
Explanation
Shared[T] handles are valid only inside the tick where share(...) creates them. Returning a Shared[T] handle from a function would allow callers to store or reuse a tick-scoped alias after the tick has advanced.
Common causes
- declaring a function return type as Shared[T]
- returning share(value) from a pure function
- using a generic helper that infers a Shared[T] return type
Canonical fixes
- return the owned value or a Copy projection instead
Before:
borrow(x: String) : Shared[String] = share(x)
After:
borrow(x: String) : String = x
- call share(...) at each tick-local use site instead of hiding it behind a return value
Code example
borrow(x: String) : Shared[String] = share(x)