move now uses its declaration for overridden =wasMoved

This commit is contained in:
ringabout
2026-05-11 19:05:05 +08:00
parent f0c60b06e5
commit 1bb7817f65
4 changed files with 47 additions and 1 deletions

View File

@@ -166,7 +166,7 @@ proc wasMoved*[T](obj: var T) {.magic: "WasMoved", noSideEffect.}
## it was "moved" and to signify its destructor should do nothing and
## ideally be optimized away.
proc move*[T](x: var T): T {.magic: "Move", noSideEffect.} =
proc move*[T](x: var T): T {.magic: "Move", noSideEffect, nodestroy.} =
result = x
{.cast(raises: []), cast(tags: []).}:
`=wasMoved`(x)