From 58f3335cc12336c32df24919e9c3800d965468d6 Mon Sep 17 00:00:00 2001 From: Eric Mastro Date: Mon, 22 Aug 2022 12:55:19 +1000 Subject: [PATCH] [fix] Fix C-compilation error failing tests --- codex/purchasing.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codex/purchasing.nim b/codex/purchasing.nim index c2ff6e3a..7991ee03 100644 --- a/codex/purchasing.nim +++ b/codex/purchasing.nim @@ -32,7 +32,9 @@ proc start(purchase: Purchase) {.gcsafe.} func id*(purchase: Purchase): PurchaseId proc `==`*(x, y: PurchaseId): bool {.borrow.} proc hash*(x: PurchaseId): Hash {.borrow.} -proc toHex*(x: PurchaseId): string {.borrow.} +# Using {.borrow.} for toHex does not borrow correctly and causes a +# C-compilation error, so we must do it long form +proc toHex*(x: PurchaseId): string = array[32, byte](x).toHex proc new*(_: type Purchasing, market: Market, clock: Clock): Purchasing = Purchasing(