diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-02-28 22:39:15 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-28 22:39:24 +0100 |
commit | 728ff1004a60835c18c44b64830ea08dc805485e (patch) | |
tree | df7c9be34196e4a8c47596ccb6a88fe4c43f84f7 /lib/core | |
parent | 9563be37d3dfed1e4bc9e3ee8955497de48b89a1 (diff) | |
download | Nim-728ff1004a60835c18c44b64830ea08dc805485e.tar.gz |
gc:destructors: progress
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/seqs.nim | 2 | ||||
-rw-r--r-- | lib/core/strs.nim | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/core/seqs.nim b/lib/core/seqs.nim index 20ea9e035..2b39c6b41 100644 --- a/lib/core/seqs.nim +++ b/lib/core/seqs.nim @@ -118,7 +118,7 @@ proc shrink*[T](x: var seq[T]; newLen: Natural) = when not supportsCopyMem(T): for i in countdown(x.len - 1, newLen - 1): `=destroy`(x[i]) - + # XXX This is wrong for const seqs that were moved into 'x'! cast[ptr NimSeqV2[T]](addr x).len = newLen proc grow*[T](x: var seq[T]; newLen: Natural; value: T) = diff --git a/lib/core/strs.nim b/lib/core/strs.nim index e55c88493..406efe5a1 100644 --- a/lib/core/strs.nim +++ b/lib/core/strs.nim @@ -164,6 +164,7 @@ proc mnewString(len: int): NimStringV2 {.compilerProc.} = proc setLengthStrV2(s: var NimStringV2, newLen: int) {.compilerRtl.} = if newLen > s.len: prepareAdd(s, newLen - s.len) + # XXX This is wrong for const strings that got moved into 's'! s.len = newLen # this also only works because the destructor # looks at s.p and not s.len |