Move wasMoved out of =destroy

This commit is contained in:
Clyybber
2020-07-08 20:48:17 +02:00
committed by Andreas Rumpf
parent 3e52136f26
commit 4a1128d16c
5 changed files with 9 additions and 19 deletions

View File

@@ -73,11 +73,10 @@ proc shrink*[T](x: var seq[T]; newLen: Natural) =
when nimvm:
setLen(x, newLen)
else:
mixin `=destroy`
#sysAssert newLen <= x.len, "invalid newLen parameter for 'shrink'"
when not supportsCopyMem(T):
for i in countdown(x.len - 1, newLen):
`=destroy`(x[i])
reset x[i]
# XXX This is wrong for const seqs that were moved into 'x'!
cast[ptr NimSeqV2[T]](addr x).len = newLen

View File

@@ -28,7 +28,6 @@ when defined(nimv2):
proc `=destroy`(a: var WideCStringObj) =
if a.data != nil:
deallocShared(a.data)
a.data = nil
proc `=`(a: var WideCStringObj; b: WideCStringObj) {.error.}