Skip to content

Commit 045b632

Browse files
committed
Merge remote-tracking branch 'upstream/stable' into merge_stable
2 parents 14b2363 + 92dc5a4 commit 045b632

File tree

5 files changed

+52
-48
lines changed

5 files changed

+52
-48
lines changed

changelog/range_predicate_element.dd

Lines changed: 0 additions & 24 deletions
This file was deleted.

changelog/upgrade-unicode.dd

Lines changed: 0 additions & 20 deletions
This file was deleted.

std/experimental/allocator/building_blocks/kernighan_ritchie.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ fronting the GC allocator.
647647
import std.experimental.allocator.gc_allocator : GCAllocator;
648648
import std.typecons : Ternary;
649649
// KRRegion fronting a general-purpose allocator
650-
ubyte[1024 * 128] buf;
650+
align(KRRegion!().alignment) ubyte[1024 * 128] buf;
651651
auto alloc = fallbackAllocator(KRRegion!()(buf), GCAllocator.instance);
652652
auto b = alloc.allocate(100);
653653
assert(b.length == 100);
@@ -916,7 +916,7 @@ version (StdUnittest)
916916
@system unittest
917917
{ import std.typecons : Ternary;
918918

919-
ubyte[1024] b;
919+
align(KRRegion!().alignment) ubyte[1024] b;
920920
auto alloc = KRRegion!()(b);
921921

922922
auto k = alloc.allocate(128);

std/net/curl.d

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2422,6 +2422,7 @@ struct HTTP
24222422
import std.algorithm.searching : findSplit, startsWith;
24232423
import std.string : indexOf, chomp;
24242424
import std.uni : toLower;
2425+
import std.exception : assumeUnique;
24252426

24262427
// Wrap incoming callback in order to separate http status line from
24272428
// http headers. On redirected requests there may be several such
@@ -2448,7 +2449,9 @@ struct HTTP
24482449
}
24492450

24502451
auto m = header.findSplit(": ");
2451-
auto fieldName = m[0].toLower();
2452+
const(char)[] lowerFieldName = m[0].toLower();
2453+
///Fixes https://issues.dlang.org/show_bug.cgi?id=24458
2454+
string fieldName = lowerFieldName is m[0] ? lowerFieldName.idup : assumeUnique(lowerFieldName);
24522455
auto fieldContent = m[2].chomp;
24532456
if (fieldName == "content-type")
24542457
{

std/typecons.d

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,14 @@ private template isBuildableFrom(U)
559559
enum isBuildableFrom(T) = isBuildable!(T, U);
560560
}
561561

562+
private enum hasCopyCtor(T) = __traits(hasCopyConstructor, T);
563+
564+
// T is expected to be an instantiation of Tuple.
565+
private template noMemberHasCopyCtor(T)
566+
{
567+
import std.meta : anySatisfy;
568+
enum noMemberHasCopyCtor = !anySatisfy!(hasCopyCtor, T.Types);
569+
}
562570

563571
/**
564572
_Tuple of values, for example $(D Tuple!(int, string)) is a record that
@@ -745,7 +753,8 @@ if (distinctFieldNames!(Specs))
745753
* compatible with the target `Tuple`'s type.
746754
*/
747755
this(U)(U another)
748-
if (areBuildCompatibleTuples!(typeof(this), U))
756+
if (areBuildCompatibleTuples!(typeof(this), U) &&
757+
(noMemberHasCopyCtor!(typeof(this)) || !is(Unqual!U == Unqual!(typeof(this)))))
749758
{
750759
field[] = another.field[];
751760
}
@@ -1655,6 +1664,42 @@ if (distinctFieldNames!(Specs))
16551664
Tuple!(MyStruct) t;
16561665
}
16571666

1667+
// https://issues.dlang.org/show_bug.cgi?id=24465
1668+
@safe unittest
1669+
{
1670+
{
1671+
static struct S
1672+
{
1673+
this(ref return scope inout(S) rhs) scope @trusted inout pure nothrow {}
1674+
}
1675+
1676+
static void foo(Tuple!S)
1677+
{
1678+
}
1679+
1680+
Tuple!S t;
1681+
foo(t);
1682+
1683+
auto t2 = Tuple!S(t);
1684+
}
1685+
1686+
{
1687+
static struct S {}
1688+
Tuple!S t;
1689+
auto t2 = Tuple!S(t);
1690+
1691+
// This can't be done if Tuple has a copy constructor, because it's not
1692+
// allowed to have an rvalue constructor at that point, and the
1693+
// compiler doesn't to something intelligent like transform it into a
1694+
// move instead. However, it has been legal with Tuple for a while
1695+
// (maybe even since it was first added) when the type doesn't have a
1696+
// copy constructor, so this is testing to make sure that the fix to
1697+
// make copy constructors work doesn't mess up the rvalue constructor
1698+
// when none of the Tuple's members have copy constructors.
1699+
auto t3 = Tuple!S(Tuple!S.init);
1700+
}
1701+
}
1702+
16581703
/**
16591704
Creates a copy of a $(LREF Tuple) with its fields in _reverse order.
16601705

0 commit comments

Comments
 (0)