[Issue 13983] RefCounted needs to be pure, @safe, nothrow
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 13 11:32:04 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=13983
Carsten Blüggel <chilli at posteo.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |chilli at posteo.net
--- Comment #7 from Carsten Blüggel <chilli at 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);
```
--
More information about the Digitalmars-d-bugs
mailing list