-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
The type ref int
can be any ref type, I discovered it with JsonNode. Returning new(int)
or nil
instead of nothing triggers the same error. Changing return
to discard
makes it go away. Returning outside the block also doesn't cause the error.
import asyncdispatch
proc foo*(): Future[ref int] {.async.} =
try:
await sleepAsync(100)
except:
return
let l = waitFor foo()
... /home/zed/.choosenim/toolchains/nim-#devel/lib/pure/asyncfutures.nim(383, 7) Hint: passing 'fut.error' to a sink parameter introduces an implicit copy; use 'move(fut.error)' to prevent it [Performance]
... /home/zed/.choosenim/toolchains/nim-#devel/lib/pure/asyncmacro.nim(82, 22) Hint: passing ':envP.future5' to a sink parameter introduces an implicit copy; use 'move(:envP.future5)' to prevent it [Performance]
... /home/zed/.choosenim/toolchains/nim-#devel/lib/pure/asyncmacro.nim(272, 31) Hint: passing ':envP.:curExc1' to a sink parameter introduces an implicit copy; use 'move(:envP.:curExc1)' to prevent it [Performance]
... /home/zed/.choosenim/toolchains/nim-#devel/lib/pure/asyncfutures.nim(383, 7) Hint: passing 'fut.error' to a sink parameter introduces an implicit copy; use 'move(fut.error)' to prevent it [Performance]
... /home/zed/src/dev/nim/nitter/src/nitter.nim(9, 5) Hint: 'l' is declared but not used [XDeclaredButNotUsed]
... CC: stdlib_asyncfutures.nim
... CC: nitter.nim
... Error: execution of an external compiler program 'gcc -c -w -I'/home/zed/.choosenim/toolchains/nim-#devel/lib' -I/home/zed/src/dev/nim/nitter/src -o /home/zed/.cache/nim/nitter_d/@mnitter.nim.c.o /home/zed/.cache/nim/nitter_d/@mnitter.nim.c' failed with exit code: 1
... /home/zed/.cache/nim/nitter_d/@mnitter.nim.c: In function ‘fooIter__bOHVpAkmxuIVS14H5G65Fg’:
... /home/zed/.cache/nim/nitter_d/@mnitter.nim.c:677:70: error: expected expression before ‘)’ token
... 677 | eq___ANG79cPfZ9aF0EzkBrohSSEw_2(&(*colonenvP_).colontmpResult2_, );
... | ^
Relevant C code:
complete__aCXgv9alzHqCt9aUCp5bIETg((*(*colonenvP_).colonup_).retFuture1, (*colonenvP_).result4);
(*colonenvP_).colonunrollFinally3_ = NIM_TRUE;
nimln_(156, "/home/zed/.choosenim/toolchains/nim-#devel/lib/pure/asyncfutures.nim");
eqsink___ANG79cPfZ9aF0EzkBrohSSEw(&(*colonenvP_).result6, NIM_NIL);
eq___ANG79cPfZ9aF0EzkBrohSSEw_2(&(*colonenvP_).colontmpResult2_, );
nimln_(69, "/home/zed/.choosenim/toolchains/nim-#devel/lib/system/excpt.nim");
eqsink___rR9boD7urcxl7uyUtE46AOA_2(&(*colonenvP_).coloncurExc1_, NIM_NIL);
(*colonenvP_).colonstate_ = ((NI) 3);