So if I change for example:
Warning: implicit conversion to 'cstring' from a non-const location: xyz.myString; this will become a compile time error in the future [CStringConv]
discard rmdir(xyz.myString)
discard rmdir(cast[cstring](xyz.myString))
is that OK? Doing an explicit cast fixes the warning.
https://nim-lang.org/docs/manual.html#types-cstring-type offers guidance on converting a cstring to a string, but not for converting a string to a cstring, it just says: "Even though the conversion is implicit, it is not safe: The garbage collector does not consider a cstring to be a root and may collect the underlying memory. For this reason, the implicit conversion will be removed in future releases of the Nim compiler."
So is an explicit cast safe or should some other method be used, perhaps copying the string contents to a new cstring variable first or something like that? I haven't found any precise advice on this, and I don't want my strings accidentally getting thrown out with the garbage :).
discard rmdir(cstring(xyz.myString))
It's pure luck that cast worked if it did.