[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 Carsten Blüggelchanged: What|Removed |Added CC||chi...@posteo.net --- Comment #7 from Carsten Blüggel --- I' m currently working on a fix for -dip1000 compilable std.algorithm.iteration which will(?) touch "RefCounted needs to be (some more) @safe" as well, sadly all by introducing @trusted :-( ; Am I completely wrong here with @trusted? These are my current typecons.RefCounted related findings in order to fix std/algorithm/iteration.d(4245): Error: @safe function std.algorithm.iteration.__unittest_L4227_C7 cannot call @system function std.algorithm.comparison.equal!().equal!(Result, string[]).equal : ``` diff --git a/std/typecons.d b/std/typecons.d index 3a36bc4..e9f79ba 100644 --- a/std/typecons.d +++ b/std/typecons.d @@ -5540,9 +5540,9 @@ if (!is(T == class) && !(is(T == interface))) { extern(C) private pure nothrow @nogc static // TODO remove pure when https://issues.dlang.org/show_bug.cgi?id=15862 has been fixed { -pragma(mangle, "free") void pureFree( void *ptr ); +pragma(mangle, "free") void pureFree( void *ptr ) @trusted; pragma(mangle, "gc_addRange") void pureGcAddRange( in void* p, size_t sz, const TypeInfo ti = null ); -pragma(mangle, "gc_removeRange") void pureGcRemoveRange( in void* p ); +pragma(mangle, "gc_removeRange") void pureGcRemoveRange( in void* p ) @trusted; } /// $(D RefCounted) storage implementation. @@ -5557,7 +5557,7 @@ if (!is(T == class) && !(is(T == interface))) private Impl* _store; -private void initialize(A...)(auto ref A args) +private void initialize(A...)(auto ref A args) @trusted { import core.exception : onOutOfMemoryError; import std.conv : emplace; @@ -5690,7 +5690,7 @@ to deallocate the corresponding resource. if (--_refCounted._store._count) return; // Done, deallocate -.destroy(_refCounted._store._payload); +() @trusted { .destroy(_refCounted._store._payload); }(); static if (hasIndirections!T) { pureGcRemoveRange(&_refCounted._store._payload); ``` --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 --- Comment #6 from Walter Bright--- Partial fix (@safe not done) pulled here: https://github.com/dlang/phobos/pull/4832 --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 Sebchanged: What|Removed |Added Blocks||18110 Referenced Issues: https://issues.dlang.org/show_bug.cgi?id=18110 [Issue 18110] most of phobos should be @safe-ly useable --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 Steven Schveighofferchanged: What|Removed |Added CC||schvei...@yahoo.com --- Comment #5 from Steven Schveighoffer --- FYI: https://github.com/dlang/phobos/pull/4692 --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 --- Comment #4 from Walter Bright--- (In reply to Jack Stouffer from comment #2) > Adding nothrow is also impossible because this throws > when the computer is out of memory. This is incorrect since the out-of-memory is an Error, not an Exception, and nothrow functions can throw Errors. --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 Walter Brightchanged: What|Removed |Added Hardware|x86 |All OS|Linux |All --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 Walter Brightchanged: What|Removed |Added Keywords||safe CC||bugzi...@digitalmars.com --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 ag0ae...@gmail.com changed: What|Removed |Added CC||ag0ae...@gmail.com --- Comment #3 from ag0ae...@gmail.com --- (In reply to Jack Stouffer from comment #2) > Adding nothrow is also impossible because this throws > when the computer is out of memory. You can still throw an OutOfMemoryError with nothrow. Or does RefCounted throw some an Exception (as opposed to an Error)? --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 Jack Stoufferchanged: What|Removed |Added CC||j...@jackstouffer.com --- Comment #2 from Jack Stouffer --- Adding @safe is impossible until a scheme is added to the language to detect escaped references. Adding nothrow is also impossible because this throws when the computer is out of memory. --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 weaselcatchanged: What|Removed |Added Blocks||15509 --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 weaselcat r9shacklef...@gmail.com changed: What|Removed |Added CC||r9shacklef...@gmail.com --- Comment #1 from weaselcat r9shacklef...@gmail.com --- ping, this requires a safe wrapper around malloc/free right? --
[Issue 13983] RefCounted needs to be pure, @safe, nothrow
https://issues.dlang.org/show_bug.cgi?id=13983 Ulrich Küttler kuett...@gmail.com changed: What|Removed |Added CC||kuett...@gmail.com --