Skip to content

Commit

Permalink
don't introduce 'dispose', use '=dispose', fixes #17003 [backport:1.4]
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Feb 16, 2021
1 parent 81703d4 commit 16c25e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/system/arc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ proc nimRawDispose(p: pointer, alignment: int) {.compilerRtl.} =
let hdrSize = align(sizeof(RefHeader), alignment)
alignedDealloc(p -! hdrSize, alignment)

template dispose*[T](x: owned(ref T)) = nimRawDispose(cast[pointer](x), T.alignOf)
template `=dispose`*[T](x: owned(ref T)) = nimRawDispose(cast[pointer](x), T.alignOf)
#proc dispose*(x: pointer) = nimRawDispose(x)

proc nimDestroyAndDispose(p: pointer) {.compilerRtl, raises: [].} =
Expand Down
2 changes: 1 addition & 1 deletion tests/destructor/tbintree2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ proc `=destroy`(t: var Tree) {.nodestroy.} =
let x = s.pop
if x.left != nil: s.add(x.left)
if x.right != nil: s.add(x.right)
dispose(x)
`=dispose`(x)
`=destroy`(s)

proc hasValue(self: var Tree, x: int32): bool =
Expand Down

0 comments on commit 16c25e1

Please sign in to comment.