Skip to content
ZOLO / TE174 Type · error

linear value escapes into a closure, task or `any`

Compiler diagnostic TE174: linear value escapes into a closure, task or `any`.

Why this fires

A linear value escapes where the checker cannot follow it: a closure or task that may outlive its block captures it, it is cast to any, or it is stored in a binding typed any.

let tx = db.begin()?
let later = || tx.rollback()   // TE174

Tasks inside scope { } or parallel { } may borrow the value, since they are joined before the block ends, but they cannot consume it.

Fix it

Pass the value as a sink argument instead of capturing it, keep its type instead of any, or run the work inside scope { }.

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

en