-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Nim Version
2.2.4
Description
Using a move-only type with Channel should not compile, since Channel, in fact, copies the item (just that it hacks the type system instead of using language features) - this leads to all kinds of guarantees being violated, for example pointer stability:
type RefBuf = object
buf*: seq[byte]
proc `=copy`(a: var RefBuf, b: RefBuf) {.error.}
var pos: ptr byte
var xxxx: ptr Channel[RefBuf]
xxxx = create(Channel[RefBuf])
xxxx[].open()
block:
var v = RefBuf(buf: newSeq[byte](10))
pos = addr v.buf[0]
xxxx[].send(move(v))
block:
var v = xxxx[].recv()
assert pos == addr v.buf[0]Current Output
Expected Output
Known Workarounds
No response
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels