Move wasMoved out of =destroy
This commit is contained in:
parent
3e52136f26
commit
4a1128d16c
5 changed files with 9 additions and 19 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue