Skip to content

Commit b9bbe95

Browse files
author
denisa.ciobanu1208
committed
make @safe
Signed-off-by: denisa.ciobanu1208 <[email protected]>
1 parent b925c16 commit b9bbe95

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

std/experimental/allocator/building_blocks/kernighan_ritchie.d

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,21 @@ struct KRRegion(ParentAllocator = NullAllocator)
111111

112112
this(this) @disable;
113113

114-
pure nothrow @trusted @nogc
114+
pure nothrow @safe @nogc
115115
void[] payload() inout
116116
{
117117
return (cast(ubyte*) &this)[0 .. size];
118118
}
119119

120-
pure nothrow @trusted @nogc
120+
pure nothrow @safe @nogc
121121
bool adjacent(in Node* right) const
122122
{
123123
assert(right);
124124
auto p = payload;
125125
return p.ptr < right && right < p.ptr + p.length + Node.sizeof;
126126
}
127127

128-
pure nothrow @trusted @nogc
128+
pure nothrow @safe @nogc
129129
bool coalesce(void* memoryEnd = null)
130130
{
131131
// Coalesce the last node before the memory end with any possible gap
@@ -156,7 +156,7 @@ struct KRRegion(ParentAllocator = NullAllocator)
156156
if (leftover >= Node.sizeof)
157157
{
158158
// There's room for another node
159-
auto newNode = (() @trusted => cast(Node*) ((cast(ubyte*) &this) + bytes))();
159+
auto newNode = (() @safe => cast(Node*) ((cast(ubyte*) &this) + bytes))();
160160
newNode.size = leftover;
161161
newNode.next = next == &this ? newNode : next;
162162
assert(next);
@@ -418,7 +418,7 @@ struct KRRegion(ParentAllocator = NullAllocator)
418418
immutable balance = root.size - actualBytes;
419419
if (balance >= Node.sizeof)
420420
{
421-
auto newRoot = (() @trusted => cast(Node*) (result + actualBytes))();
421+
auto newRoot = (() @safe => cast(Node*) (result + actualBytes))();
422422
newRoot.next = root.next;
423423
newRoot.size = balance;
424424
root = newRoot;
@@ -428,7 +428,7 @@ struct KRRegion(ParentAllocator = NullAllocator)
428428
root = null;
429429
switchToFreeList;
430430
}
431-
return (() @trusted => result[0 .. n])();
431+
return (() @safe => result[0 .. n])();
432432
}
433433

434434
// Not enough memory, switch to freelist mode and fall through
@@ -604,7 +604,7 @@ struct KRRegion(ParentAllocator = NullAllocator)
604604
It does a simple $(BIGOH 1) range check. `b` should be a buffer either
605605
allocated with `this` or obtained through other means.
606606
*/
607-
pure nothrow @trusted @nogc
607+
pure nothrow @safe @nogc
608608
Ternary owns(void[] b)
609609
{
610610
debug(KRRegion) assertValid("owns");
@@ -942,3 +942,4 @@ version (StdUnittest)
942942
assert(alloc.deallocate(k));
943943
assert(alloc.empty == Ternary.yes);
944944
}
945+

0 commit comments

Comments
 (0)