Closed cheatfate closed 6 years ago
Nimbus compiles fine for me. Perhaps you weren't using the latest version of chronicles. A new tag was just pushed.
Wiped nimble directory, executed nimble install -y
and got
eth_p2p\blockchain_sync.nim(291, 14) Error: type mismatch: got <Future[system.void], proc (data: pointer){.closure, locks: <unknown>.}>
... but expected one of:
... proc callback=[T](future: Future[T]; cb: CallbackFunc)
... first type mismatch at position: 2
... required type: CallbackFunc
... but expression 'proc (data: pointer) = if failed(f()):
... block chroniclesLogStmt:
... var record1958474:
... defaultChroniclesStreamLogRecord
... discard
... let (color1958502, bright1958504) = case ERROR
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1958502, bright1958504)
... write(stdout, case ERROR
... of TRACE:
... "TRC"
... of DEBUG:
... "DBG"
... of INFO:
... "INF"
... of NOTICE:
... "NOT"
... of WARN:
... "WRN"
... of ERROR:
... "ERR"
... of FATAL:
... "FAT"
... of NONE:
... " "
... )
... resetAttributes(stdout)
... record1958474.level = ERROR
... write(stdout, " ")
... appendRfcTimestamp(record1958474.output)
... if (
... ## "is greater" operator. This is the same as ``y < x``.
... true):
... let padding1959806 = " "
... write(stdout, " ")
... setStyle(stdout, {styleBright})
... write(stdout, "startSyncWithPeer failed")
... write(stdout, padding1959806)
... resetAttributes(stdout)
... if (
... ## "is greater" operator. This is the same as ``y < x``.
... false):
... write(stdout, " topics=\"")
... setForegroundColor(stdout, fgYellow, true)
... write(stdout, "")
... resetAttributes(stdout)
... write(stdout, "\"")
... write(stdout, " ")
... let valText1960628 = "0"
... var
... escaped1960630: string
... valueToWrite1960633: ptr string
... let
... needsEscape1960649 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1960628, {10, 13, 34, 92}, 0, 0)
... needsQuote1960654 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1960628, {' ', '='}, 0, 0)
... if needsEscape1960649 or needsQuote1960654:
... escaped1960630 = newStringOfCap(chckRange(len(valText1960628) * len(valText1960628) div
... 8, 0, 9223372036854775807))
... if needsEscape1960649:
... addQuoted(escaped1960630, valText1960628)
... elif needsQuote1960654:
... add(escaped1960630, '\"')
... add(escaped1960630, valText1960628)
... add(escaped1960630, '\"')
... valueToWrite1960633 = addr(escaped1960630)
... else:
... valueToWrite1960633 = addr(valText1960628)
... let (color1960683, bright1960685) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1960683, bright1960685)
... write(stdout, "thread")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1960633[])
... resetAttributes(stdout)
... write(stdout, " ")
... let valText1961638 = $readError(f).msg
... var
... escaped1961640: string
... valueToWrite1961643: ptr string
... let
... needsEscape1961659 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1961638, {10, 13, 34, 92}, 0, 0)
... needsQuote1961664 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1961638, {' ', '='}, 0, 0)
... if needsEscape1961659 or needsQuote1961664:
... escaped1961640 = newStringOfCap(chckRange(len(valText1961638) * len(valText1961638) div
... 8, 0, 9223372036854775807))
... if needsEscape1961659:
... addQuoted(escaped1961640, valText1961638)
... elif needsQuote1961664:
... add(escaped1961640, '\"')
... add(escaped1961640, valText1961638)
... add(escaped1961640, '\"')
... valueToWrite1961643 = addr(escaped1961640)
... else:
... valueToWrite1961643 = addr(valText1961638)
... let (color1961693, bright1961695) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1961693, bright1961695)
... write(stdout, "msg")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1961643[])
... resetAttributes(stdout)
... write(stdout, " ")
... let valText1962623 = $peer
... var
... escaped1962625: string
... valueToWrite1962628: ptr string
... let
... needsEscape1962644 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1962623, {10, 13, 34, 92}, 0, 0)
... needsQuote1962649 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1962623, {' ', '='}, 0, 0)
... if needsEscape1962644 or needsQuote1962649:
... escaped1962625 = newStringOfCap(chckRange(len(valText1962623) * len(valText1962623) div
... 8, 0, 9223372036854775807))
... if needsEscape1962644:
... addQuoted(escaped1962625, valText1962623)
... elif needsQuote1962649:
... add(escaped1962625, '\"')
... add(escaped1962625, valText1962623)
... add(escaped1962625, '\"')
... valueToWrite1962628 = addr(escaped1962625)
... else:
... valueToWrite1962628 = addr(valText1962623)
... let (color1962678, bright1962680) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1962678, bright1962680)
... write(stdout, "peer")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1962628[])
... resetAttributes(stdout)
... logAllDynamicProperties(
... defaultChroniclesStream, record1958474)
... write(stdout, "\n")
... flushFile(stdout)' is of type: proc (data: pointer){.closure, locks: <unknown>.}
... This expression is not GC-safe. Annotate the proc with {.gcsafe.} to get extended error information.
... proc callback=(future: FutureBase; cb: CallbackFunc; udata: pointer = nil)
... first type mismatch at position: 2
... required type: CallbackFunc
... but expression 'proc (data: pointer) = if failed(f()):
... block chroniclesLogStmt:
... var record1958474:
... defaultChroniclesStreamLogRecord
... discard
... let (color1958502, bright1958504) = case ERROR
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1958502, bright1958504)
... write(stdout, case ERROR
... of TRACE:
... "TRC"
... of DEBUG:
... "DBG"
... of INFO:
... "INF"
... of NOTICE:
... "NOT"
... of WARN:
... "WRN"
... of ERROR:
... "ERR"
... of FATAL:
... "FAT"
... of NONE:
... " "
... )
... resetAttributes(stdout)
... record1958474.level = ERROR
... write(stdout, " ")
... appendRfcTimestamp(record1958474.output)
... if (
... ## "is greater" operator. This is the same as ``y < x``.
... true):
... let padding1959806 = " "
... write(stdout, " ")
... setStyle(stdout, {styleBright})
... write(stdout, "startSyncWithPeer failed")
... write(stdout, padding1959806)
... resetAttributes(stdout)
... if (
... ## "is greater" operator. This is the same as ``y < x``.
... false):
... write(stdout, " topics=\"")
... setForegroundColor(stdout, fgYellow, true)
... write(stdout, "")
... resetAttributes(stdout)
... write(stdout, "\"")
... write(stdout, " ")
... let valText1960628 = "0"
... var
... escaped1960630: string
... valueToWrite1960633: ptr string
... let
... needsEscape1960649 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1960628, {10, 13, 34, 92}, 0, 0)
... needsQuote1960654 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1960628, {' ', '='}, 0, 0)
... if needsEscape1960649 or needsQuote1960654:
... escaped1960630 = newStringOfCap(chckRange(len(valText1960628) * len(valText1960628) div
... 8, 0, 9223372036854775807))
... if needsEscape1960649:
... addQuoted(escaped1960630, valText1960628)
... elif needsQuote1960654:
... add(escaped1960630, '\"')
... add(escaped1960630, valText1960628)
... add(escaped1960630, '\"')
... valueToWrite1960633 = addr(escaped1960630)
... else:
... valueToWrite1960633 = addr(valText1960628)
... let (color1960683, bright1960685) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1960683, bright1960685)
... write(stdout, "thread")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1960633[])
... resetAttributes(stdout)
... write(stdout, " ")
... let valText1961638 = $readError(f).msg
... var
... escaped1961640: string
... valueToWrite1961643: ptr string
... let
... needsEscape1961659 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1961638, {10, 13, 34, 92}, 0, 0)
... needsQuote1961664 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1961638, {' ', '='}, 0, 0)
... if needsEscape1961659 or needsQuote1961664:
... escaped1961640 = newStringOfCap(chckRange(len(valText1961638) * len(valText1961638) div
... 8, 0, 9223372036854775807))
... if needsEscape1961659:
... addQuoted(escaped1961640, valText1961638)
... elif needsQuote1961664:
... add(escaped1961640, '\"')
... add(escaped1961640, valText1961638)
... add(escaped1961640, '\"')
... valueToWrite1961643 = addr(escaped1961640)
... else:
... valueToWrite1961643 = addr(valText1961638)
... let (color1961693, bright1961695) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1961693, bright1961695)
... write(stdout, "msg")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1961643[])
... resetAttributes(stdout)
... write(stdout, " ")
... let valText1962623 = $peer
... var
... escaped1962625: string
... valueToWrite1962628: ptr string
... let
... needsEscape1962644 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1962623, {10, 13, 34, 92}, 0, 0)
... needsQuote1962649 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1962623, {' ', '='}, 0, 0)
... if needsEscape1962644 or needsQuote1962649:
... escaped1962625 = newStringOfCap(chckRange(len(valText1962623) * len(valText1962623) div
... 8, 0, 9223372036854775807))
... if needsEscape1962644:
... addQuoted(escaped1962625, valText1962623)
... elif needsQuote1962649:
... add(escaped1962625, '\"')
... add(escaped1962625, valText1962623)
... add(escaped1962625, '\"')
... valueToWrite1962628 = addr(escaped1962625)
... else:
... valueToWrite1962628 = addr(valText1962623)
... let (color1962678, bright1962680) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1962678, bright1962680)
... write(stdout, "peer")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1962628[])
... resetAttributes(stdout)
... logAllDynamicProperties(
... defaultChroniclesStream, record1958474)
... write(stdout, "\n")
... flushFile(stdout)' is of type: proc (data: pointer){.closure, locks: <unknown>.}
... This expression is not GC-safe. Annotate the proc with {.gcsafe.} to get extended error information.
... expression: callback=(f, proc (data: pointer) = if failed(f()):
... block chroniclesLogStmt:
... var record1958474:
... defaultChroniclesStreamLogRecord
... discard
... let (color1958502, bright1958504) = case ERROR
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1958502, bright1958504)
... write(stdout, case ERROR
... of TRACE:
... "TRC"
... of DEBUG:
... "DBG"
... of INFO:
... "INF"
... of NOTICE:
... "NOT"
... of WARN:
... "WRN"
... of ERROR:
... "ERR"
... of FATAL:
... "FAT"
... of NONE:
... " "
... )
... resetAttributes(stdout)
... record1958474.level = ERROR
... write(stdout, " ")
... appendRfcTimestamp(record1958474.output)
... if (
... ## "is greater" operator. This is the same as ``y < x``.
... true):
... let padding1959806 = " "
... write(stdout, " ")
... setStyle(stdout, {styleBright})
... write(stdout, "startSyncWithPeer failed")
... write(stdout, padding1959806)
... resetAttributes(stdout)
... if (
... ## "is greater" operator. This is the same as ``y < x``.
... false):
... write(stdout, " topics=\"")
... setForegroundColor(stdout, fgYellow, true)
... write(stdout, "")
... resetAttributes(stdout)
... write(stdout, "\"")
... write(stdout, " ")
... let valText1960628 = "0"
... var
... escaped1960630: string
... valueToWrite1960633: ptr string
... let
... needsEscape1960649 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1960628, {10, 13, 34, 92}, 0, 0)
... needsQuote1960654 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1960628, {' ', '='}, 0, 0)
... if needsEscape1960649 or needsQuote1960654:
... escaped1960630 = newStringOfCap(chckRange(len(valText1960628) * len(valText1960628) div
... 8, 0, 9223372036854775807))
... if needsEscape1960649:
... addQuoted(escaped1960630, valText1960628)
... elif needsQuote1960654:
... add(escaped1960630, '\"')
... add(escaped1960630, valText1960628)
... add(escaped1960630, '\"')
... valueToWrite1960633 = addr(escaped1960630)
... else:
... valueToWrite1960633 = addr(valText1960628)
... let (color1960683, bright1960685) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1960683, bright1960685)
... write(stdout, "thread")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1960633[])
... resetAttributes(stdout)
... write(stdout, " ")
... let valText1961638 = $readError(f).msg
... var
... escaped1961640: string
... valueToWrite1961643: ptr string
... let
... needsEscape1961659 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1961638, {10, 13, 34, 92}, 0, 0)
... needsQuote1961664 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1961638, {' ', '='}, 0, 0)
... if needsEscape1961659 or needsQuote1961664:
... escaped1961640 = newStringOfCap(chckRange(len(valText1961638) * len(valText1961638) div
... 8, 0, 9223372036854775807))
... if needsEscape1961659:
... addQuoted(escaped1961640, valText1961638)
... elif needsQuote1961664:
... add(escaped1961640, '\"')
... add(escaped1961640, valText1961638)
... add(escaped1961640, '\"')
... valueToWrite1961643 = addr(escaped1961640)
... else:
... valueToWrite1961643 = addr(valText1961638)
... let (color1961693, bright1961695) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1961693, bright1961695)
... write(stdout, "msg")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1961643[])
... resetAttributes(stdout)
... write(stdout, " ")
... let valText1962623 = $peer
... var
... escaped1962625: string
... valueToWrite1962628: ptr string
... let
... needsEscape1962644 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1962623, {10, 13, 34, 92}, 0, 0)
... needsQuote1962649 =
... ## "is greater" operator. This is the same as ``y < x``.
... -1 < find(valText1962623, {' ', '='}, 0, 0)
... if needsEscape1962644 or needsQuote1962649:
... escaped1962625 = newStringOfCap(chckRange(len(valText1962623) * len(valText1962623) div
... 8, 0, 9223372036854775807))
... if needsEscape1962644:
... addQuoted(escaped1962625, valText1962623)
... elif needsQuote1962649:
... add(escaped1962625, '\"')
... add(escaped1962625, valText1962623)
... add(escaped1962625, '\"')
... valueToWrite1962628 = addr(escaped1962625)
... else:
... valueToWrite1962628 = addr(valText1962623)
... let (color1962678, bright1962680) = case record1958474.level
... of TRACE:
... (fgGreen, true)
... of DEBUG:
... (fgGreen, true)
... of INFO:
... (fgGreen, false)
... of NOTICE:
... (fgYellow, false)
... of WARN:
... (fgYellow, true)
... of ERROR:
... (fgRed, false)
... of FATAL:
... (fgRed, true)
... of NONE:
... (fgWhite, false)
... setForegroundColor(stdout, color1962678, bright1962680)
... write(stdout, "peer")
... resetAttributes(stdout)
... write(stdout, "=")
... setForegroundColor(stdout, fgCyan, true)
... write(stdout, valueToWrite1962628[])
... resetAttributes(stdout)
... logAllDynamicProperties(
... defaultChroniclesStream, record1958474)
... write(stdout, "\n")
... flushFile(stdout))
Is Chronicles the culprit? Does the problem go away when you comment out line 293.
291: f.callback = proc(data: pointer) =
292: if f.failed:
293: error "startSyncWithPeer failed", msg = f.readError.msg, peer
What if you try to explicitly put some pragmas on this closure such as gcsafe
, closure
, etc?