Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion std/checkedint.d
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ if (isIntegral!T || is(T == Checked!(U, H), U, H))
import std.experimental.allocator.common : stateSize;
import std.format.spec : FormatSpec;
import std.range.primitives : isInputRange, ElementType;
import std.traits : hasMember, isSomeChar;
import std.traits : isSomeChar;

/**
The type of the integral subject to checking.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ struct AffixAllocator(Allocator, Prefix, Suffix = void)
roundUpToMultipleOf, alignedAt, alignDownTo, roundUpToMultipleOf,
hasStaticallyKnownAlignment;
import std.math.traits : isPowerOf2;
import std.traits : hasMember;
import std.typecons : Ternary;

static if (hasStaticallyKnownAlignment!Allocator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import std.experimental.allocator.building_blocks.null_allocator;
// Common function implementation for thread local and shared AlignedBlockList
private mixin template AlignedBlockListImpl(bool isShared)
{
import std.traits : hasMember;
import std.typecons : Ternary;

static if (isShared)
Expand Down Expand Up @@ -313,8 +312,6 @@ struct AlignedBlockList(Allocator, ParentAllocator, ulong theAlignment = (1 << 2
version (StdDdoc)
{
import std.typecons : Ternary;
import std.traits : hasMember;

/**
Returns a chunk of memory of size `n`
It finds the first node in the `AlignedBlockNode` list which has available memory,
Expand Down Expand Up @@ -473,7 +470,6 @@ shared struct SharedAlignedBlockList(Allocator, ParentAllocator, ulong theAlignm
version (StdDdoc)
{
import std.typecons : Ternary;
import std.traits : hasMember;

/**
Returns a chunk of memory of size `n`
Expand Down
2 changes: 0 additions & 2 deletions std/experimental/allocator/building_blocks/allocator_list.d
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ struct AllocatorList(Factory, BookkeepingAllocator = GCAllocator)
import core.lifetime : emplace;
import std.experimental.allocator.building_blocks.stats_collector
: StatsCollector, Options;
import std.traits : hasMember;
import std.typecons : Ternary;

private enum ouroboros = is(BookkeepingAllocator == NullAllocator);
Expand Down Expand Up @@ -670,7 +669,6 @@ version (Posix) @system unittest
shared struct SharedAllocatorList(Factory, BookkeepingAllocator = GCAllocator)
{
import std.typecons : Ternary;
import std.traits : hasMember;
import core.internal.spinlock : SpinLock;

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,6 @@ version (StdUnittest)
{
static void testAlloc(Allocator)(ref Allocator a) @nogc nothrow
{
import std.traits : hasMember;

size_t numPages = 5;
uint alignment = cast(uint) pageSize;

Expand Down
3 changes: 0 additions & 3 deletions std/experimental/allocator/building_blocks/bitmapped_block.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import std.typecons : Flag, Yes, No;
private mixin template BitmappedBlockImpl(bool isShared, bool multiBlock)
{
import std.conv : text;
import std.traits : hasMember;
import std.typecons : Ternary;
import std.typecons : tuple, Tuple;

Expand Down Expand Up @@ -1392,7 +1391,6 @@ struct BitmappedBlock(size_t theBlockSize, uint theAlignment = platformAlignment
{
// Create a block allocator on top of a 10KB stack region.
import std.experimental.allocator.building_blocks.region : InSituRegion;
import std.traits : hasMember;
InSituRegion!(10_240, 64) r;
auto a = BitmappedBlock!(64, 64)(cast(ubyte[])(r.allocateAll()));
static assert(__traits(hasMember, InSituRegion!(10_240, 64), "allocateAll"));
Expand Down Expand Up @@ -1728,7 +1726,6 @@ shared struct SharedBitmappedBlock(size_t theBlockSize, uint theAlignment = plat
// Test chooseAtRuntime
// Create a block allocator on top of a 10KB stack region.
import std.experimental.allocator.building_blocks.region : InSituRegion;
import std.traits : hasMember;
InSituRegion!(10_240, 64) r;
uint blockSize = 64;
auto a = BitmappedBlock!(chooseAtRuntime, 64)(cast(ubyte[])(r.allocateAll()), blockSize);
Expand Down
1 change: 0 additions & 1 deletion std/experimental/allocator/building_blocks/bucketizer.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct Bucketizer(Allocator, size_t min, size_t max, size_t step)
{
import common = std.experimental.allocator.common : roundUpToMultipleOf,
alignedAt;
import std.traits : hasMember;
import std.typecons : Ternary;

static assert((max - (min - 1)) % step == 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ up by the `GCAllocator`.
struct FallbackAllocator(Primary, Fallback)
{
import std.algorithm.comparison : min;
import std.traits : hasMember;
import std.typecons : Ternary;

// Need both allocators to be stateless
Expand Down
3 changes: 0 additions & 3 deletions std/experimental/allocator/building_blocks/free_list.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ struct FreeList(ParentAllocator,
{
import std.conv : text;
import std.exception : enforce;
import std.traits : hasMember;
import std.typecons : Ternary;
import std.experimental.allocator.building_blocks.null_allocator : NullAllocator;

Expand Down Expand Up @@ -525,7 +524,6 @@ struct ContiguousFreeList(ParentAllocator,
: NullAllocator;
import std.experimental.allocator.building_blocks.stats_collector
: StatsCollector, Options;
import std.traits : hasMember;
import std.typecons : Ternary;

alias Impl = FreeList!(NullAllocator, minSize, maxSize);
Expand Down Expand Up @@ -863,7 +861,6 @@ struct SharedFreeList(ParentAllocator,
{
import std.conv : text;
import std.exception : enforce;
import std.traits : hasMember;

static if (__traits(hasMember, ParentAllocator, "owns"))
{
Expand Down
1 change: 0 additions & 1 deletion std/experimental/allocator/building_blocks/free_tree.d
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct FreeTree(ParentAllocator)

import std.algorithm.comparison : min, max;
import std.algorithm.mutation : swap;
import std.traits : hasMember;

// State
static if (stateSize!ParentAllocator) private ParentAllocator parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ information is available in client code at deallocation time.)
struct KRRegion(ParentAllocator = NullAllocator)
{
import std.experimental.allocator.common : stateSize, alignedAt;
import std.traits : hasMember;
import std.typecons : Ternary;

private static struct Node
Expand Down
2 changes: 0 additions & 2 deletions std/experimental/allocator/building_blocks/quantizer.d
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ always return the same value for a given `n`.)
*/
struct Quantizer(ParentAllocator, alias roundingFunction)
{
import std.traits : hasMember;

/**
The parent allocator. Depending on whether `ParentAllocator` holds state
or not, this is a member variable or an alias for
Expand Down
3 changes: 0 additions & 3 deletions std/experimental/allocator/building_blocks/region.d
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct Region(ParentAllocator,
static assert(minAlign.isGoodStaticAlignment);
static assert(ParentAllocator.alignment >= minAlign);

import std.traits : hasMember;
import std.typecons : Ternary;

// state
Expand Down Expand Up @@ -693,7 +692,6 @@ struct InSituRegion(size_t size, size_t minAlign = platformAlignment)
{
import std.algorithm.comparison : max;
import std.conv : to;
import std.traits : hasMember;
import std.typecons : Ternary;
import core.thread.types : isStackGrowingDown;

Expand Down Expand Up @@ -1172,7 +1170,6 @@ shared struct SharedRegion(ParentAllocator,
static assert(minAlign.isGoodStaticAlignment);
static assert(ParentAllocator.alignment >= minAlign);

import std.traits : hasMember;
import std.typecons : Ternary;

// state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ struct ScopedAllocator(ParentAllocator)

import std.experimental.allocator.building_blocks.affix_allocator
: AffixAllocator;
import std.traits : hasMember;
import std.typecons : Ternary;

private struct Node
Expand Down
2 changes: 1 addition & 1 deletion std/experimental/allocator/building_blocks/segregator.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ shared) methods.
struct Segregator(size_t threshold, SmallAllocator, LargeAllocator)
{
import std.algorithm.comparison : min;
import std.traits : hasMember, ReturnType;
import std.traits : ReturnType;
import std.typecons : Ternary;

static if (stateSize!SmallAllocator) private SmallAllocator _small;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ struct StatsCollector(Allocator, ulong flags = Options.all,
ulong perCallFlags = 0)
{
private:
import std.traits : hasMember, Signed;
import std.traits : Signed;
import std.typecons : Ternary;

static string define(string type, string[] names...)
Expand Down
2 changes: 1 addition & 1 deletion std/experimental/allocator/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ Forwards each of the methods in `funs` (if defined) to `member`.
*/
/*package*/ string forwardToMember(string member, string[] funs...)
{
string result = " import std.traits : hasMember, Parameters;\n";
string result = " import std.traits : Parameters;\n";
foreach (fun; funs)
{
result ~= "
Expand Down
7 changes: 0 additions & 7 deletions std/experimental/allocator/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -2698,7 +2698,6 @@ if (!isPointer!A)
{
auto state = a.allocate(stateSize!(CAllocatorImpl!A));
import std.algorithm.mutation : move;
import std.traits : hasMember;
static if (__traits(hasMember, A, "deallocate"))
{
scope(failure) a.deallocate(state);
Expand All @@ -2715,7 +2714,6 @@ RCIAllocator allocatorObject(A)(A* pa)
assert(pa);
import core.lifetime : emplace;
auto state = pa.allocate(stateSize!(CAllocatorImpl!(A, Yes.indirect)));
import std.traits : hasMember;
static if (__traits(hasMember, A, "deallocate"))
{
scope(failure) pa.deallocate(state);
Expand Down Expand Up @@ -2812,7 +2810,6 @@ if (!isPointer!A)
{
auto state = a.allocate(stateSize!(CSharedAllocatorImpl!A));
import std.algorithm.mutation : move;
import std.traits : hasMember;
static if (__traits(hasMember, A, "deallocate"))
{
scope(failure) a.deallocate(state);
Expand All @@ -2833,7 +2830,6 @@ RCISharedAllocator sharedAllocatorObject(A)(A* pa)
assert(pa);
import core.lifetime : emplace;
auto state = pa.allocate(stateSize!(CSharedAllocatorImpl!(A, Yes.indirect)));
import std.traits : hasMember;
static if (__traits(hasMember, A, "deallocate"))
{
scope(failure) pa.deallocate(state);
Expand All @@ -2853,8 +2849,6 @@ Usually `CAllocatorImpl` is used indirectly by calling $(LREF theAllocator).
class CAllocatorImpl(Allocator, Flag!"indirect" indirect = No.indirect)
: IAllocator
{
import std.traits : hasMember;

static if (stateSize!Allocator) private size_t rc = 1;

/**
Expand Down Expand Up @@ -3082,7 +3076,6 @@ $(LREF processAllocator).
class CSharedAllocatorImpl(Allocator, Flag!"indirect" indirect = No.indirect)
: ISharedAllocator
{
import std.traits : hasMember;
import core.atomic : atomicOp, atomicLoad;

static if (stateSize!Allocator) shared size_t rc = 1;
Expand Down
1 change: 0 additions & 1 deletion std/experimental/allocator/showcase.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module std.experimental.allocator.showcase;
import std.experimental.allocator.building_blocks.fallback_allocator,
std.experimental.allocator.gc_allocator,
std.experimental.allocator.building_blocks.region;
import std.traits : hasMember;

/**

Expand Down
Loading