March 12, 2018 [Issue 13983] RefCounted needs to be pure, @safe, nothrow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13983 --- Comment #6 from Walter Bright <bugzilla@digitalmars.com> --- Partial fix (@safe not done) pulled here: https://github.com/dlang/phobos/pull/4832 -- |
March 13, 2018 [Issue 13983] RefCounted needs to be pure, @safe, nothrow | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13983 Carsten Blüggel <chilli@posteo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chilli@posteo.net --- Comment #7 from Carsten Blüggel <chilli@posteo.net> --- 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); ``` -- |
August 25, 2021 [Issue 13983] RefCounted needs to be @safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13983 Ate Eskola <Ajieskola@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Ajieskola@gmail.com Summary|RefCounted needs to be |RefCounted needs to be |pure, @safe, nothrow |@safe --- Comment #8 from Ate Eskola <Ajieskola@gmail.com> --- Regarding nothrow and pure, this is fixed as Phobos unittests confirm. Changing the title. And by the way, the struct is also @nogc and -betterC. @safe remains a problem though. It cannot be added in vanilla D, but with -dip1000 flag there may be hope. Atila recently made a PR that attempts to do just that: https://github.com/dlang/phobos/pull/8101 -- |
December 17, 2022 [Issue 13983] RefCounted needs to be @safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13983 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P2 -- |
March 03, 2023 [Issue 13983] RefCounted needs to be @safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13983 Ate Eskola <Ajieskola@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #9 from Ate Eskola <Ajieskola@gmail.com> --- Solved by https://github.com/dlang/phobos/pull/8368. Well, mostly. Caveat 1: It is only `@safe` with the -preview=dip1000 flag. But AFAIK there's no solution to that. Generic safe reference counting without DIP1000 is simply impossible. Caveat 2: To be precise, `RefCounted` is still `@system`. To avoid backward compatibility problems, you have to use `SafeRefCounted` instead if you want to be safe. Feel free to open another issue if you feel these caveats need closing. -- |
March 23, 2023 [Issue 13983] RefCounted needs to be @safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13983 elpenguino+D@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |elpenguino+D@gmail.com --- Comment #10 from elpenguino+D@gmail.com --- This hasn't been solved at all. RefCounted still isn't @safe. SafeRefCounted is merely a workaround. If the existing RefCounted isn't going to be made @safe, it should be deprecated and removed. -- |
Copyright © 1999-2021 by the D Language Foundation