diff mbox series

[committed] d: Merge upstream dmd, druntime b65767825f, phobos 92dc5a4e9.

Message ID 20240406122729.48487-1-ibuclaw@gdcproject.org
State New
Headers show
Series [committed] d: Merge upstream dmd, druntime b65767825f, phobos 92dc5a4e9. | expand

Commit Message

Iain Buclaw April 6, 2024, 12:27 p.m. UTC
Hi,

This patch merges the D front-end and runtime library with upstream dmd
b65767825f, and the standard library with phobos 92dc5a4e9.

Synchronizing with the upstream release of v2.108.0.

D front-end changes:

	- Import dmd v2.108.0.

D runtime changes:

	- Import druntime v2.108.0.

Phobos changes:

	- Import phobos v2.108.0.

Bootstrapped and regression tested on x86_64-linux-gnu/-m32, committed
to mainline.

Regards,
Iain.

---
gcc/d/ChangeLog:

	* dmd/MERGE: Merge upstream dmd b65767825f.
	* dmd/VERSION: Bump version to v2.108.0.

libphobos/ChangeLog:

	* libdruntime/MERGE: Merge upstream druntime b65767825f.
	* src/MERGE: Merge upstream phobos 92dc5a4e9.
---
 gcc/d/dmd/MERGE                               |  2 +-
 gcc/d/dmd/VERSION                             |  2 +-
 libphobos/libdruntime/MERGE                   |  2 +-
 .../core/internal/array/duplication.d         | 14 +++++-
 libphobos/src/MERGE                           |  2 +-
 .../building_blocks/kernighan_ritchie.d       |  4 +-
 libphobos/src/std/net/curl.d                  |  5 +-
 libphobos/src/std/typecons.d                  | 47 ++++++++++++++++++-
 8 files changed, 68 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index a00872ef864..dc47db87a80 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@ 
-855353a1d9e16d43e85b6cf2b03aef388619bd16
+b65767825f365dbc153457fc86e1054b03196c6d
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/VERSION b/gcc/d/dmd/VERSION
index 8ca452f8912..5868b874955 100644
--- a/gcc/d/dmd/VERSION
+++ b/gcc/d/dmd/VERSION
@@ -1 +1 @@ 
-v2.108.0-rc.1
+v2.108.0
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index a00872ef864..dc47db87a80 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@ 
-855353a1d9e16d43e85b6cf2b03aef388619bd16
+b65767825f365dbc153457fc86e1054b03196c6d
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
diff --git a/libphobos/libdruntime/core/internal/array/duplication.d b/libphobos/libdruntime/core/internal/array/duplication.d
index eec6af92fef..9df84893bb9 100644
--- a/libphobos/libdruntime/core/internal/array/duplication.d
+++ b/libphobos/libdruntime/core/internal/array/duplication.d
@@ -21,9 +21,9 @@  U[] _dup(T, U)(scope T[] a) pure nothrow @trusted if (__traits(isPOD, T))
     {
         import core.stdc.string : memcpy;
         import core.internal.array.construction: _d_newarrayUPureNothrow;
-        auto arr = _d_newarrayUPureNothrow!T(a.length, is(T == shared));
+        auto arr = _d_newarrayUPureNothrow!U(a.length, is(U == shared));
         memcpy(cast(void*) arr.ptr, cast(const(void)*) a.ptr, T.sizeof * a.length);
-        return *cast(U[]*) &arr;
+        return arr;
     }
 }
 
@@ -358,3 +358,13 @@  U[] _dup(T, U)(T[] a) if (!__traits(isPOD, T))
     static assert(test!Copy());
     assert(test!Copy());
 }
+
+// https://issues.dlang.org/show_bug.cgi?id=24453
+@safe unittest
+{
+    static inout(char)[] foo(ref scope return inout(char)[] s)
+    {
+        auto bla = s.idup;
+        return s;
+    }
+}
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index ff34bece2a3..a4f25db810e 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@ 
-a2ade9dec49e70c6acd447df52321988a4c2fb9f
+92dc5a4e98591a0e6b0af4ff0f84f096fea09016
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/phobos repository.
diff --git a/libphobos/src/std/experimental/allocator/building_blocks/kernighan_ritchie.d b/libphobos/src/std/experimental/allocator/building_blocks/kernighan_ritchie.d
index 6883d33adae..167cf1bc6bc 100644
--- a/libphobos/src/std/experimental/allocator/building_blocks/kernighan_ritchie.d
+++ b/libphobos/src/std/experimental/allocator/building_blocks/kernighan_ritchie.d
@@ -647,7 +647,7 @@  fronting the GC allocator.
     import std.experimental.allocator.gc_allocator : GCAllocator;
     import std.typecons : Ternary;
     // KRRegion fronting a general-purpose allocator
-    ubyte[1024 * 128] buf;
+    align(KRRegion!().alignment) ubyte[1024 * 128] buf;
     auto alloc = fallbackAllocator(KRRegion!()(buf), GCAllocator.instance);
     auto b = alloc.allocate(100);
     assert(b.length == 100);
@@ -916,7 +916,7 @@  version (StdUnittest)
 @system unittest
 {   import std.typecons : Ternary;
 
-    ubyte[1024] b;
+    align(KRRegion!().alignment) ubyte[1024] b;
     auto alloc = KRRegion!()(b);
 
     auto k = alloc.allocate(128);
diff --git a/libphobos/src/std/net/curl.d b/libphobos/src/std/net/curl.d
index 6aec366c657..3f823013e65 100644
--- a/libphobos/src/std/net/curl.d
+++ b/libphobos/src/std/net/curl.d
@@ -2422,6 +2422,7 @@  struct HTTP
             import std.algorithm.searching : findSplit, startsWith;
             import std.string : indexOf, chomp;
             import std.uni : toLower;
+            import std.exception : assumeUnique;
 
             // Wrap incoming callback in order to separate http status line from
             // http headers.  On redirected requests there may be several such
@@ -2448,7 +2449,9 @@  struct HTTP
                     }
 
                     auto m = header.findSplit(": ");
-                    auto fieldName = m[0].toLower();
+                    const(char)[] lowerFieldName = m[0].toLower();
+                    ///Fixes https://issues.dlang.org/show_bug.cgi?id=24458
+                    string fieldName = lowerFieldName is m[0] ? lowerFieldName.idup : assumeUnique(lowerFieldName);
                     auto fieldContent = m[2].chomp;
                     if (fieldName == "content-type")
                     {
diff --git a/libphobos/src/std/typecons.d b/libphobos/src/std/typecons.d
index 5fac1c9cca4..460cd427ed0 100644
--- a/libphobos/src/std/typecons.d
+++ b/libphobos/src/std/typecons.d
@@ -559,6 +559,14 @@  private template isBuildableFrom(U)
     enum isBuildableFrom(T) = isBuildable!(T, U);
 }
 
+private enum hasCopyCtor(T) = __traits(hasCopyConstructor, T);
+
+// T is expected to be an instantiation of Tuple.
+private template noMemberHasCopyCtor(T)
+{
+    import std.meta : anySatisfy;
+    enum noMemberHasCopyCtor = !anySatisfy!(hasCopyCtor, T.Types);
+}
 
 /**
 _Tuple of values, for example $(D Tuple!(int, string)) is a record that
@@ -745,7 +753,8 @@  if (distinctFieldNames!(Specs))
          *               compatible with the target `Tuple`'s type.
          */
         this(U)(U another)
-        if (areBuildCompatibleTuples!(typeof(this), U))
+        if (areBuildCompatibleTuples!(typeof(this), U) &&
+            (noMemberHasCopyCtor!(typeof(this)) || !is(Unqual!U == Unqual!(typeof(this)))))
         {
             field[] = another.field[];
         }
@@ -1655,6 +1664,42 @@  if (distinctFieldNames!(Specs))
     Tuple!(MyStruct) t;
 }
 
+// https://issues.dlang.org/show_bug.cgi?id=24465
+@safe unittest
+{
+    {
+        static struct S
+        {
+            this(ref return scope inout(S) rhs) scope @trusted inout pure nothrow {}
+        }
+
+        static void foo(Tuple!S)
+        {
+        }
+
+        Tuple!S t;
+        foo(t);
+
+        auto t2 = Tuple!S(t);
+    }
+
+    {
+        static struct S {}
+        Tuple!S t;
+        auto t2 = Tuple!S(t);
+
+        // This can't be done if Tuple has a copy constructor, because it's not
+        // allowed to have an rvalue constructor at that point, and the
+        // compiler doesn't to something intelligent like transform it into a
+        // move instead. However, it has been legal with Tuple for a while
+        // (maybe even since it was first added) when the type doesn't have a
+        // copy constructor, so this is testing to make sure that the fix to
+        // make copy constructors work doesn't mess up the rvalue constructor
+        // when none of the Tuple's members have copy constructors.
+        auto t3 = Tuple!S(Tuple!S.init);
+    }
+}
+
 /**
     Creates a copy of a $(LREF Tuple) with its fields in _reverse order.