Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
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
12 changes: 6 additions & 6 deletions src/core/atomic.d
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ enum MemoryOrder
* Returns:
* The value of 'val'.
*/
T atomicLoad(MemoryOrder ms = MemoryOrder.seq, T)(ref const T val) pure nothrow @nogc @trusted
T atomicLoad(MemoryOrder ms = MemoryOrder.seq, T)(return ref const T val) pure nothrow @nogc @trusted
if (!is(T == shared U, U) && !is(T == shared inout U, U) && !is(T == shared const U, U))
{
static if (__traits(isFloating, T))
Expand All @@ -80,7 +80,7 @@ T atomicLoad(MemoryOrder ms = MemoryOrder.seq, T)(ref const T val) pure nothrow
}

/// Ditto
T atomicLoad(MemoryOrder ms = MemoryOrder.seq, T)(ref shared const T val) pure nothrow @nogc @trusted
T atomicLoad(MemoryOrder ms = MemoryOrder.seq, T)(return ref shared const T val) pure nothrow @nogc @trusted
if (!hasUnsharedIndirections!T)
{
import core.internal.traits : hasUnsharedIndirections;
Expand Down Expand Up @@ -162,7 +162,7 @@ void atomicStore(MemoryOrder ms = MemoryOrder.seq, T, V)(ref shared T val, share
* Returns:
* The value held previously by `val`.
*/
T atomicFetchAdd(MemoryOrder ms = MemoryOrder.seq, T)(ref T val, size_t mod) pure nothrow @nogc @trusted
T atomicFetchAdd(MemoryOrder ms = MemoryOrder.seq, T)(return ref T val, size_t mod) pure nothrow @nogc @trusted
if ((__traits(isIntegral, T) || is(T == U*, U)) && !is(T == shared))
in (atomicValueIsProperlyAligned(val))
{
Expand All @@ -173,7 +173,7 @@ in (atomicValueIsProperlyAligned(val))
}

/// Ditto
T atomicFetchAdd(MemoryOrder ms = MemoryOrder.seq, T)(ref shared T val, size_t mod) pure nothrow @nogc @trusted
T atomicFetchAdd(MemoryOrder ms = MemoryOrder.seq, T)(return ref shared T val, size_t mod) pure nothrow @nogc @trusted
if (__traits(isIntegral, T) || is(T == U*, U))
in (atomicValueIsProperlyAligned(val))
{
Expand All @@ -191,7 +191,7 @@ in (atomicValueIsProperlyAligned(val))
* Returns:
* The value held previously by `val`.
*/
T atomicFetchSub(MemoryOrder ms = MemoryOrder.seq, T)(ref T val, size_t mod) pure nothrow @nogc @trusted
T atomicFetchSub(MemoryOrder ms = MemoryOrder.seq, T)(return ref T val, size_t mod) pure nothrow @nogc @trusted
if ((__traits(isIntegral, T) || is(T == U*, U)) && !is(T == shared))
in (atomicValueIsProperlyAligned(val))
{
Expand All @@ -202,7 +202,7 @@ in (atomicValueIsProperlyAligned(val))
}

/// Ditto
T atomicFetchSub(MemoryOrder ms = MemoryOrder.seq, T)(ref shared T val, size_t mod) pure nothrow @nogc @trusted
T atomicFetchSub(MemoryOrder ms = MemoryOrder.seq, T)(return ref shared T val, size_t mod) pure nothrow @nogc @trusted
if (__traits(isIntegral, T) || is(T == U*, U))
in (atomicValueIsProperlyAligned(val))
{
Expand Down
14 changes: 7 additions & 7 deletions src/core/demangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ pure @safe:
* The demangled name or the original string if the name is not a mangled D
* name.
*/
char[] demangle( const(char)[] buf, char[] dst = null ) nothrow pure @safe
char[] demangle(return scope const(char)[] buf, return scope char[] dst = null ) nothrow pure @safe
{
auto d = Demangle!()(buf, dst);
// fast path (avoiding throwing & catching exception) for obvious
Expand Down Expand Up @@ -2075,7 +2075,7 @@ char[] demangleType( const(char)[] buf, char[] dst = null ) nothrow pure @safe
* Returns:
* The mangled name with deduplicated identifiers
*/
char[] reencodeMangled(const(char)[] mangled) nothrow pure @safe
char[] reencodeMangled(return scope const(char)[] mangled) nothrow pure @safe
{
static struct PrependHooks
{
Expand Down Expand Up @@ -2247,7 +2247,7 @@ char[] reencodeMangled(const(char)[] mangled) nothrow pure @safe
* The mangled name for a symbols of type T and the given fully
* qualified name.
*/
char[] mangle(T)(const(char)[] fqn, char[] dst = null) @safe pure nothrow
char[] mangle(T)(return scope const(char)[] fqn, return scope char[] dst = null) @safe pure nothrow
{
import core.internal.string : numDigits, unsignedToTempString;

Expand All @@ -2264,13 +2264,13 @@ char[] mangle(T)(const(char)[] fqn, char[] dst = null) @safe pure nothrow
return i == -1 ? s[0 .. $] : s[0 .. i];
}

void popFront()
void popFront() scope
{
immutable i = indexOfDot();
s = i == -1 ? s[$ .. $] : s[i+1 .. $];
}

private ptrdiff_t indexOfDot() const
private ptrdiff_t indexOfDot() const scope
{
foreach (i, c; s) if (c == '.') return i;
return -1;
Expand Down Expand Up @@ -2337,7 +2337,7 @@ char[] mangle(T)(const(char)[] fqn, char[] dst = null) @safe pure nothrow
* The mangled name for a function with function pointer type T and
* the given fully qualified name.
*/
char[] mangleFunc(T:FT*, FT)(const(char)[] fqn, char[] dst = null) @safe pure nothrow if (is(FT == function))
char[] mangleFunc(T:FT*, FT)(return scope const(char)[] fqn, return scope char[] dst = null) @safe pure nothrow if (is(FT == function))
{
static if (isExternD!FT)
{
Expand Down Expand Up @@ -2601,7 +2601,7 @@ unittest
{
char[] buf = new char[i];
auto ds = demangle(s, buf);
assert(ds == "pure nothrow @safe char[] core.demangle.demangle(const(char)[], char[])");
assert(ds == "pure nothrow @safe char[] core.demangle.demangle(scope return const(char)[], scope return char[])");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/gc/gcinterface.d
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ interface GC
/*
*
*/
BlkInfo qalloc(size_t size, uint bits, const TypeInfo ti) nothrow;
BlkInfo qalloc(size_t size, uint bits, const scope TypeInfo ti) nothrow;

/*
*
Expand Down
2 changes: 1 addition & 1 deletion src/core/internal/array/appending.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
module core.internal.array.appending;

/// See $(REF _d_arrayappendcTX, rt,lifetime,_d_arrayappendcTX)
private extern (C) byte[] _d_arrayappendcTX(const TypeInfo ti, ref byte[] px, size_t n) @trusted pure nothrow;
private extern (C) byte[] _d_arrayappendcTX(const TypeInfo ti, ref return scope byte[] px, size_t n) @trusted pure nothrow;

private enum isCopyingNothrow(T) = __traits(compiles, (ref T rhs) nothrow { T lhs = rhs; });

Expand Down
2 changes: 1 addition & 1 deletion src/core/internal/array/casting.d
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Params:
Returns:
`from` reinterpreted as `TTo[]`
*/
TTo[] __ArrayCast(TFrom, TTo)(TFrom[] from) @nogc pure @trusted
TTo[] __ArrayCast(TFrom, TTo)(return scope TFrom[] from) @nogc pure @trusted
{
const fromSize = from.length * TFrom.sizeof;
const toLength = fromSize / TTo.sizeof;
Expand Down
2 changes: 1 addition & 1 deletion src/core/internal/array/concatenation.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
module core.internal.array.concatenation;

/// See $(REF _d_arraycatnTX, rt,lifetime)
private extern (C) void[] _d_arraycatnTX(const TypeInfo ti, byte[][] arrs) pure nothrow;
private extern (C) void[] _d_arraycatnTX(const TypeInfo ti, scope byte[][] arrs) pure nothrow;

/// Implementation of `_d_arraycatnTX` and `_d_arraycatnTXTrace`
template _d_arraycatnTXImpl(Tarr : ResultArrT[], ResultArrT : T[], T)
Expand Down
14 changes: 7 additions & 7 deletions src/core/internal/convert.d
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private ubyte[] ctfe_alloc(size_t n)
}

@trusted pure nothrow @nogc
const(ubyte)[] toUbyte(T)(const ref T val) if (__traits(isFloating, T) && (is(T : real) || is(T : ireal)))
const(ubyte)[] toUbyte(T)(const scope ref T val) if (__traits(isFloating, T) && (is(T : real) || is(T : ireal)))
{
if (__ctfe)
{
Expand Down Expand Up @@ -645,13 +645,13 @@ package template floatSize(T) if (is(T:real) || is(T:ireal))

// all toUbyte functions must be evaluable at compile time
@trusted pure nothrow @nogc
const(ubyte)[] toUbyte(T)(const T[] arr) if (T.sizeof == 1)
const(ubyte)[] toUbyte(T)(return scope const T[] arr) if (T.sizeof == 1)
{
return cast(const(ubyte)[])arr;
}

@trusted pure nothrow @nogc
const(ubyte)[] toUbyte(T)(const T[] arr) if (T.sizeof > 1)
const(ubyte)[] toUbyte(T)(return scope const T[] arr) if (T.sizeof > 1)
{
if (__ctfe)
{
Expand Down Expand Up @@ -683,7 +683,7 @@ const(ubyte)[] toUbyte(T)(const T[] arr) if (T.sizeof > 1)
}

@trusted pure nothrow @nogc
const(ubyte)[] toUbyte(T)(const ref T val) if (__traits(isIntegral, T) && !is(T == enum) && !is(T == __vector))
const(ubyte)[] toUbyte(T)(const ref scope T val) if (__traits(isIntegral, T) && !is(T == enum) && !is(T == __vector))
{
static if (T.sizeof == 1)
{
Expand Down Expand Up @@ -720,7 +720,7 @@ const(ubyte)[] toUbyte(T)(const ref T val) if (__traits(isIntegral, T) && !is(T
}

@trusted pure nothrow @nogc
const(ubyte)[] toUbyte(T)(const ref T val) if (is(T == __vector))
const(ubyte)[] toUbyte(T)(const ref scope T val) if (is(T == __vector))
{
if (!__ctfe)
return (cast(const ubyte*) &val)[0 .. T.sizeof];
Expand All @@ -744,7 +744,7 @@ const(ubyte)[] toUbyte(T)(const ref T val) if (is(T == __vector))
// @@@DEPRECATED_2022-02@@@
deprecated
@trusted pure nothrow @nogc
const(ubyte)[] toUbyte(T)(const ref T val) if (__traits(isFloating, T) && is(T : creal))
const(ubyte)[] toUbyte(T)(const ref return scope T val) if (__traits(isFloating, T) && is(T : creal))
{
if (__ctfe)
{
Expand All @@ -764,7 +764,7 @@ const(ubyte)[] toUbyte(T)(const ref T val) if (__traits(isFloating, T) && is(T :
}

@trusted pure nothrow @nogc
const(ubyte)[] toUbyte(T)(const ref T val) if (is(T == enum))
const(ubyte)[] toUbyte(T)(const ref return scope T val) if (is(T == enum))
{
if (__ctfe)
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/internal/gc/impl/conservative/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class ConservativeGC : GC
}


BlkInfo qalloc( size_t size, uint bits, const TypeInfo ti) nothrow
BlkInfo qalloc( size_t size, uint bits, const scope TypeInfo ti) nothrow
{

if (!size)
Expand Down
2 changes: 1 addition & 1 deletion src/core/internal/gc/impl/manual/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ManualGC : GC
return p;
}

BlkInfo qalloc(size_t size, uint bits, const TypeInfo ti) nothrow
BlkInfo qalloc(size_t size, uint bits, const scope TypeInfo ti) nothrow
{
BlkInfo retval;
retval.base = malloc(size, bits, ti);
Expand Down
20 changes: 10 additions & 10 deletions src/core/internal/gc/impl/proto/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ private
extern (C) void gc_enable() nothrow;
extern (C) void gc_disable() nothrow;

extern (C) void* gc_malloc( size_t sz, uint ba = 0, const TypeInfo = null ) pure nothrow;
extern (C) void* gc_calloc( size_t sz, uint ba = 0, const TypeInfo = null ) pure nothrow;
extern (C) BlkInfo gc_qalloc( size_t sz, uint ba = 0, const TypeInfo = null ) pure nothrow;
extern (C) void* gc_realloc( void* p, size_t sz, uint ba = 0, const TypeInfo = null ) pure nothrow;
extern (C) void* gc_malloc( size_t sz, uint ba = 0, const scope TypeInfo = null ) pure nothrow;
extern (C) void* gc_calloc( size_t sz, uint ba = 0, const scope TypeInfo = null ) pure nothrow;
extern (C) BlkInfo gc_qalloc( size_t sz, uint ba = 0, const scope TypeInfo = null ) pure nothrow;
extern (C) void* gc_realloc(return scope void* p, size_t sz, uint ba = 0, const scope TypeInfo = null ) pure nothrow;
extern (C) size_t gc_reserve( size_t sz ) nothrow;

extern (C) void gc_addRange(const void* p, size_t sz, const TypeInfo ti = null ) nothrow @nogc;
extern (C) void gc_addRange(const void* p, size_t sz, const scope TypeInfo ti = null ) nothrow @nogc;
extern (C) void gc_addRoot(const void* p ) nothrow @nogc;
}

Expand Down Expand Up @@ -99,31 +99,31 @@ class ProtoGC : GC
return 0;
}

void* malloc(size_t size, uint bits, const TypeInfo ti) nothrow
void* malloc(size_t size, uint bits, const scope TypeInfo ti) nothrow
{
.gc_init_nothrow();
return .gc_malloc(size, bits, ti);
}

BlkInfo qalloc(size_t size, uint bits, const TypeInfo ti) nothrow
BlkInfo qalloc(size_t size, uint bits, const scope TypeInfo ti) nothrow
{
.gc_init_nothrow();
return .gc_qalloc(size, bits, ti);
}

void* calloc(size_t size, uint bits, const TypeInfo ti) nothrow
void* calloc(size_t size, uint bits, const scope TypeInfo ti) nothrow
{
.gc_init_nothrow();
return .gc_calloc(size, bits, ti);
}

void* realloc(void* p, size_t size, uint bits, const TypeInfo ti) nothrow
void* realloc(void* p, size_t size, uint bits, const scope TypeInfo ti) nothrow
{
.gc_init_nothrow();
return .gc_realloc(p, size, bits, ti);
}

size_t extend(void* p, size_t minsize, size_t maxsize, const TypeInfo ti) nothrow
size_t extend(void* p, size_t minsize, size_t maxsize, const scope TypeInfo ti) nothrow
{
return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions src/core/internal/gc/proxy.d
Original file line number Diff line number Diff line change
Expand Up @@ -157,27 +157,27 @@ extern (C)
return instance.clrAttr(p, a);
}

void* gc_malloc( size_t sz, uint ba = 0, const TypeInfo ti = null ) nothrow
void* gc_malloc( size_t sz, uint ba = 0, const scope TypeInfo ti = null ) nothrow
{
return instance.malloc(sz, ba, ti);
}

BlkInfo gc_qalloc( size_t sz, uint ba = 0, const TypeInfo ti = null ) nothrow
BlkInfo gc_qalloc( size_t sz, uint ba = 0, const scope TypeInfo ti = null ) nothrow
{
return instance.qalloc( sz, ba, ti );
}

void* gc_calloc( size_t sz, uint ba = 0, const TypeInfo ti = null ) nothrow
void* gc_calloc( size_t sz, uint ba = 0, const scope TypeInfo ti = null ) nothrow
{
return instance.calloc( sz, ba, ti );
}

void* gc_realloc( void* p, size_t sz, uint ba = 0, const TypeInfo ti = null ) nothrow
void* gc_realloc( void* p, size_t sz, uint ba = 0, const scope TypeInfo ti = null ) nothrow
{
return instance.realloc( p, sz, ba, ti );
}

size_t gc_extend( void* p, size_t mx, size_t sz, const TypeInfo ti = null ) nothrow
size_t gc_extend( void* p, size_t mx, size_t sz, const scope TypeInfo ti = null ) nothrow
{
return instance.extend( p, mx, sz,ti );
}
Expand Down
13 changes: 7 additions & 6 deletions src/core/lifetime.d
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ Params:
*/
void move(T)(ref T source, ref T target)
{
moveImpl(source, target);
moveImpl(target, source);
}

/// For non-struct types, `move` just performs `target = source`:
Expand Down Expand Up @@ -1915,7 +1915,7 @@ pure nothrow @safe @nogc unittest
static assert(is(typeof({ S s; move(s, s); }) == T));
}

private void moveImpl(T)(ref T source, ref T target)
private void moveImpl(T)(scope ref T target, return ref T source)
{
import core.internal.traits : hasElaborateDestructor;

Expand All @@ -1927,7 +1927,7 @@ private void moveImpl(T)(ref T source, ref T target)
static if (hasElaborateDestructor!T) target.__xdtor();
}
// move and emplace source into target
moveEmplaceImpl(source, target);
moveEmplaceImpl(target, source);
}

private T moveImpl(T)(ref T source)
Expand All @@ -1942,7 +1942,7 @@ private T moveImpl(T)(ref T source)
private T trustedMoveImpl(T)(ref T source) @trusted
{
T result = void;
moveEmplaceImpl(source, result);
moveEmplaceImpl(result, source);
return result;
}

Expand Down Expand Up @@ -2083,7 +2083,8 @@ private T trustedMoveImpl(T)(ref T source) @trusted
move(x, x);
}

private void moveEmplaceImpl(T)(ref T source, ref T target)
// target must be first-parameter, because in void-functions DMD + dip1000 allows it to take the place of a return-scope
private void moveEmplaceImpl(T)(scope ref T target, return scope ref T source)
{
import core.stdc.string : memcpy, memset;
import core.internal.traits;
Expand Down Expand Up @@ -2152,7 +2153,7 @@ private void moveEmplaceImpl(T)(ref T source, ref T target)
*/
void moveEmplace(T)(ref T source, ref T target) @system
{
moveEmplaceImpl(source, target);
moveEmplaceImpl(target, source);
}

///
Expand Down
Loading