E1009: drop of a binding that is borrowed
While an abs view of an owner is live, the owner is frozen.
While an abs view of an owner is live, the owner is frozen. ADR-0027 says an
owner cannot be dropped while it is frozen by a view, because the view would
point at a released resource. The view lives until the end of the block that
holds it, whether or not it is used again. The error points at the drop.
Example
An abs struct field is a view too. The source stays frozen until the end of
the block that builds the struct:
A call whose result can hold a view freezes the sources it was given through
abs parameters, as the struct literal above does, because the callee may
return a struct that views any of them:
Fix
End the view first by putting it in an inner block, then drop the owner.
Run actus explain E1009 in your terminal to read this entry offline. Browse Ownership & types or all error codes.