Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 59963cc

Browse files
committed
add 'scope' to object.dup()
1 parent 49f9d5d commit 59963cc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/object.d

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,7 +3293,7 @@ unittest
32933293
}
32943294

32953295
/// Provide the .dup array property.
3296-
@property auto dup(T)(T[] a)
3296+
@property auto dup(T)(scope T[] a)
32973297
if (!is(const(T) : T))
32983298
{
32993299
import core.internal.traits : Unconst;
@@ -3309,7 +3309,7 @@ unittest
33093309

33103310
/// ditto
33113311
// const overload to support implicit conversion to immutable (unique result, see DIP29)
3312-
@property T[] dup(T)(const(T)[] a)
3312+
@property T[] dup(T)(scope const(T)[] a)
33133313
if (is(const(T) : T))
33143314
{
33153315
// wrap unsafe _dup in @trusted to preserve @safe postblit
@@ -3320,14 +3320,14 @@ unittest
33203320
}
33213321

33223322
/// ditto
3323-
@property T[] dup(T:void)(const(T)[] a) @trusted
3323+
@property T[] dup(T:void)(scope const(T)[] a) @trusted
33243324
{
33253325
if (__ctfe) assert(0, "Cannot dup a void[] array at compile time.");
33263326
return cast(T[])_rawDup(a);
33273327
}
33283328

33293329
/// Provide the .idup array property.
3330-
@property immutable(T)[] idup(T)(T[] a)
3330+
@property immutable(T)[] idup(T)(scope T[] a)
33313331
{
33323332
static assert(is(T : immutable(T)), "Cannot implicitly convert type "~T.stringof~
33333333
" to immutable in idup.");
@@ -3340,17 +3340,17 @@ unittest
33403340
}
33413341

33423342
/// ditto
3343-
@property immutable(T)[] idup(T:void)(const(T)[] a)
3343+
@property immutable(T)[] idup(T:void)(scope const(T)[] a)
33443344
{
33453345
return a.dup;
33463346
}
33473347

3348-
private U[] _trustedDup(T, U)(T[] a) @trusted
3348+
private U[] _trustedDup(T, U)(scope T[] a) @trusted
33493349
{
33503350
return _dup!(T, U)(a);
33513351
}
33523352

3353-
private U[] _dup(T, U)(T[] a) // pure nothrow depends on postblit
3353+
private U[] _dup(T, U)(scope T[] a) // pure nothrow depends on postblit
33543354
{
33553355
if (__ctfe)
33563356
{
@@ -3368,7 +3368,7 @@ private U[] _dup(T, U)(T[] a) // pure nothrow depends on postblit
33683368

33693369
private extern (C) void[] _d_newarrayU(const TypeInfo ti, size_t length) pure nothrow;
33703370

3371-
private inout(T)[] _rawDup(T)(inout(T)[] a)
3371+
private inout(T)[] _rawDup(T)(scope inout(T)[] a)
33723372
{
33733373
import core.stdc.string : memcpy;
33743374

0 commit comments

Comments
 (0)