On Tuesday, 21 June 2022 at 14:40:41 UTC, Antonio wrote:
The problem:

"use" can't be @safe because it contains a call to "destroy".

`destroy` should be `@safe` as long as the destructor it's calling is `@safe`.

If the destructor is `@system`, then the only way to call `destroy` in `@safe` code is to (1) determine the conditions necessary to call the destructor without violating memory safety, (2) ensure that those conditions are met (using compile time and/or runtime checks), and (3) wrap the call to `destroy` in a `@trusted` function.

Since step (1) depends on the specific details of the destructor you want to call, I can't give any more specific advice unless you show a complete example that includes the destructor.

Reply via email to