Skip to content

Commit 0ebf719

Browse files
authored
Merge pull request #6353 from dlang/revert-6295-std_container_slist
Revert "std.container.slist: Fix a @safe cannot call @System issue"
2 parents 2b1c98e + b0aa559 commit 0ebf719

File tree

2 files changed

+5
-30
lines changed

2 files changed

+5
-30
lines changed

dip1000.mak

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ aa[std.zlib]=-dip1000
6060
aa[std.algorithm.comparison]=-dip1000
6161
aa[std.algorithm.internal]=-dip1000
6262
aa[std.algorithm.iteration]=-dip25 # WIP_carblue
63-
aa[std.algorithm.mutation]=-dip1000
63+
aa[std.algorithm.mutation]=-dip25 # depends on std.container.slist (https://github.com/dlang/phobos/pull/6295)
6464
aa[std.algorithm.package]=-dip1000
6565
aa[std.algorithm.searching]=-dip25 # depends on https://github.com/dlang/phobos/pull/6246 merged and std.algorithm.comparison fixed
6666
aa[std.algorithm.setops]=-dip1000
@@ -95,7 +95,7 @@ aa[std.container.binaryheap]=-dip1000
9595
aa[std.container.dlist]=-dip1000
9696
aa[std.container.package]=-dip1000
9797
aa[std.container.rbtree]=-dip25 # DROP
98-
aa[std.container.slist]=-dip1000 -version=DIP1000 # merged https://github.com/dlang/phobos/pull/6295
98+
aa[std.container.slist]=-dip25 # -dip1000 -version=DIP1000 depends on https://github.com/dlang/phobos/pull/6295 merged
9999
aa[std.container.util]=-dip25 # TODO
100100

101101
aa[std.datetime.date]=-dip25 # depends on a fix for writefln

std/container/slist.d

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,9 @@ struct SList(T)
138138
/**
139139
Constructor taking a number of nodes
140140
*/
141-
this(U)(scope U[] values...) if (isImplicitlyConvertible!(U, T))
141+
this(U)(U[] values...) if (isImplicitlyConvertible!(U, T))
142142
{
143-
initialize();
144-
Node* n, newRoot;
145-
foreach (item; values)
146-
{
147-
auto newNode = new Node(null, item);
148-
(newRoot ? n._next : newRoot) = newNode;
149-
n = newNode;
150-
}
151-
if (n)
152-
{
153-
// Last node points to the old root
154-
n._next = _first;
155-
_first = newRoot;
156-
}
143+
insertFront(values);
157144
}
158145

159146
/**
@@ -372,7 +359,7 @@ Complexity: $(BIGOH m), where $(D m) is the length of $(D stuff)
372359
{
373360
initialize();
374361
size_t result;
375-
Node* n, newRoot;
362+
Node * n, newRoot;
376363
foreach (item; stuff)
377364
{
378365
auto newNode = new Node(null, item);
@@ -924,15 +911,3 @@ Complexity: $(BIGOH n)
924911
s.reverse();
925912
assert(s[].equal([3, 2, 1]));
926913
}
927-
928-
version(DIP1000)
929-
@safe unittest
930-
{
931-
int i, j;
932-
auto s = SList!(int*)([&i, &j]);
933-
assert(s._root);
934-
assert(s._root._next);
935-
assert(s._root._next._next);
936-
assert(s._root._next._payload == &i);
937-
assert(s._root._next._next._payload == &j);
938-
}

0 commit comments

Comments
 (0)