diff options
author | Jason Beetham <beefers331@gmail.com> | 2022-04-11 06:27:12 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 14:27:12 +0200 |
commit | 26acc97864ede8e19dddd52aa04e0139da356e3e (patch) | |
tree | 0d69b67f2a704aab50ee83515a5f3a81f170c257 | |
parent | a77ffdb7ea4ec66983d3481cc486c821a5df6b1b (diff) | |
download | Nim-26acc97864ede8e19dddd52aa04e0139da356e3e.tar.gz |
StringStreams no longer errors when intialized with literals on arc/orc (#19708)
-rw-r--r-- | lib/pure/streams.nim | 2 | ||||
-rw-r--r-- | tests/stdlib/tstreams.nim | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index 7ad81685f..84451f989 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -1274,6 +1274,8 @@ else: # after 1.3 or JS not defined new(result) result.data = s + when defined(gcOrc) or defined(gcArc): + prepareMutation(result.data) # Allows us to mutate using `addr` logic like `copyMem`, otherwise it errors. result.pos = 0 result.closeImpl = ssClose result.atEndImpl = ssAtEnd diff --git a/tests/stdlib/tstreams.nim b/tests/stdlib/tstreams.nim index c2ceed624..d70d4995a 100644 --- a/tests/stdlib/tstreams.nim +++ b/tests/stdlib/tstreams.nim @@ -74,3 +74,5 @@ block: doAssert(ss.peekLine(str)) doAssert(str == "uick brown fox jumped over the lazy dog.") doAssert(ss.getPosition == 5) # haven't moved + ss.setPosition(0) # Ensure we dont error with writing over literals on arc/orc #19707 + ss.write("hello") |