On Tuesday, 13 August 2019 at 17:18:23 UTC, ag0aep6g wrote:
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:
Probably this @trusted is not a problem (std.container.dlist also
contain @trusted code). I mistakenly ignored this case.
Thanks for your report, and I'll create issue on github.
<https://github.com/ikod/cachetools/blob/ac72aafe979e2f95a343eb9d19b1b67915e4fc17/source/cachetools/containers/lists.d#L391>.
Other containers probably have similar problems.