bynk.held.consume_on_borrow
Error A consuming operation (close/put/take) is called on a borrowed held reference — borrows admit only non-consuming operations like send (§2.9.3, real-time track slice 2).
A held value such as a Connection[F] has exactly one owner, and the owner must dispose of it by storing, closing or handing it on. A closure that visits each stored connection (forEach, parTraverse and their variants) is only lent each one: it may send, which leaves the connection owned, but close or any transfer would be an owner's act performed on a value the closure does not own. A match guard borrows in the same way, because it runs before its arm is chosen. To close connections, remove them from the store, which closes them, in the owner's code and not in the closure.
Example
conns.forEach((c: Connection[ServerFrame]) => c.close()) // ✗ `c` is borrowed
conns.forEach((c: Connection[ServerFrame]) => c.send(ServerFrame { text: "closing" })) // ✓ `send` does not consumeIn the Book
See also
- Every code in its category, Other, on the diagnostic index.
bynk explain bynk.held.consume_on_borrowshows the same from the installed toolchain, without a network.