import asyncdispatch type testType = object testField: bool proc testProc(thing: var testType) {.async.} = if not thing.testField: thing.testField = true var x: testType waitFor testProc(x) Run
<https://play.nim-lang.org/#ix=3IGJ> results in: Error: 'thing' is of type <var testType> which cannot be captured as it would violate memory safety, declared here: /usercode/in.nim(8, 15); using '-d:nimNoLentIterators' helps in some cases Run