summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/system.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 179dc175a..a04433530 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1657,6 +1657,13 @@ else:
     new(r)
     return r
 
+template disarm*(x: typed) =
+  ## Useful for ``disarming`` dangling pointers explicitly for the
+  ## --newruntime. Regardless of whether --newruntime is used or not
+  ## this sets the pointer or callback ``x`` to ``nil``. This is an
+  ## experimental API!
+  x = nil
+
 proc `of`*[T, S](x: typeDesc[T], y: typeDesc[S]): bool {.magic: "Of", noSideEffect.}
 proc `of`*[T, S](x: T, y: typeDesc[S]): bool {.magic: "Of", noSideEffect.}
 proc `of`*[T, S](x: T, y: S): bool {.magic: "Of", noSideEffect.}