From b2cda7b13f19d54e5a6bb25fe3a9be3458504dc1 Mon Sep 17 00:00:00 2001 From: Antonis Geralis Date: Thu, 16 Jan 2025 16:56:22 +0200 Subject: [PATCH] try to fix koch boot --- lib/system.nim | 6 +++++- lib/system/seqs_v2.nim | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/system.nim b/lib/system.nim index ee67509de651..e8d8a8c51311 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2968,7 +2968,11 @@ when notJSnotNims and not defined(nimSeqsV2): proc arrayWith*[T](y: T, size: static int): array[size, T] {.noinit, nodestroy, raises: [].} = ## Creates a new array filled with `y`. for i in 0..size-1: - result[i] = `=dup`(y) + when (NimMajor, NimMinor, NimPatch) >= (2, 3, 1): + result[i] = `=dup`(y) + else: + wasMoved(result[i]) + `=copy`(result[i], y) proc arrayWithDefault*[T](size: static int): array[size, T] {.noinit, nodestroy, raises: [].} = ## Creates a new array filled with `default(T)`. diff --git a/lib/system/seqs_v2.nim b/lib/system/seqs_v2.nim index 86da7638ad5c..6ace66afeab3 100644 --- a/lib/system/seqs_v2.nim +++ b/lib/system/seqs_v2.nim @@ -144,7 +144,11 @@ proc grow*[T](x: var seq[T]; newLen: Natural; value: T) {.nodestroy.} = xu.p = cast[typeof(xu.p)](prepareSeqAddUninit(oldLen, xu.p, newLen - oldLen, sizeof(T), alignof(T))) xu.len = newLen for i in oldLen .. newLen-1: - xu.p.data[i] = `=dup`(value) + when (NimMajor, NimMinor, NimPatch) >= (2, 3, 1): + xu.p.data[i] = `=dup`(value) + else: + wasMoved(xu.p.data[i]) + `=copy`(xu.p.data[i], value) proc add*[T](x: var seq[T]; y: sink T) {.magic: "AppendSeqElem", noSideEffect, nodestroy.} = ## Generic proc for adding a data item `y` to a container `x`.