cachetools v.0.3.1

ag0aep6g anonymous at example.com
Tue Aug 13 17:18:23 UTC 2019


On 13.08.19 11:34, ikod wrote:
> What is it?
> 
> cachetools - package with @safe and @nogc cache and containers 
> implementations.
[...]
> Project page: https://github.com/ikod/cachetools
> docs: https://ikod.github.io/cachetools/

They don't seem to actually be @safe. An example:

----
import cachetools.containers.lists;
import std.stdio;
void main() @safe
{
     DList!int dl;
     dl.insert_first(42);
     auto r = dl.range;
     dl.clear();
     writeln(r.front); /* Prints garbage, because it's accessing `free`d 
memory. */
}
----

As far as I can I see, that compiles because you have a bad @trusted 
here: 
<https://github.com/ikod/cachetools/blob/ac72aafe979e2f95a343eb9d19b1b67915e4fc17/source/cachetools/containers/lists.d#L391>.

Other containers probably have similar problems.


More information about the Digitalmars-d-announce mailing list