fixes refc with non-var destructor; cancel warnings (#23156)

fixes https://forum.nim-lang.org/t/10807
This commit is contained in:
ringabout
2024-02-13 15:11:49 +08:00
committed by GitHub
parent 1e9a3c438b
commit 35ec9c31bd
4 changed files with 23 additions and 7 deletions

View File

@@ -68,7 +68,8 @@ type
proc `=copy`*(x: var Task, y: Task) {.error.}
when defined(nimAllowNonVarDestructor):
const arcLike = defined(gcArc) or defined(gcAtomicArc) or defined(gcOrc)
when defined(nimAllowNonVarDestructor) and arcLike:
proc `=destroy`*(t: Task) {.inline, gcsafe.} =
## Frees the resources allocated for a `Task`.
if t.args != nil:

View File

@@ -25,7 +25,8 @@ when not (defined(cpu16) or defined(cpu8)):
bytes: int
data: WideCString
when defined(nimAllowNonVarDestructor):
const arcLike = defined(gcArc) or defined(gcAtomicArc) or defined(gcOrc)
when defined(nimAllowNonVarDestructor) and arcLike:
proc `=destroy`(a: WideCStringObj) =
if a.data != nil:
when compileOption("threads"):