]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
d: Merge upstream dmd, druntime b65767825f, phobos 92dc5a4e9.
authorIain Buclaw <ibuclaw@gdcproject.org>
Sat, 6 Apr 2024 12:14:11 +0000 (14:14 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sat, 6 Apr 2024 12:26:37 +0000 (14:26 +0200)
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.

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
gcc/d/dmd/VERSION
libphobos/libdruntime/MERGE
libphobos/libdruntime/core/internal/array/duplication.d
libphobos/src/MERGE
libphobos/src/std/experimental/allocator/building_blocks/kernighan_ritchie.d
libphobos/src/std/net/curl.d
libphobos/src/std/typecons.d

index a00872ef864d4b863620b01d78a832e64fedf29a..dc47db87a80c8f1793d091c9eda6982763ee56aa 100644 (file)
@@ -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.
index 8ca452f8912224655a8f902715a31d9417b313ae..5868b8749552b20dabaab75e95f6e1d522972269 100644 (file)
@@ -1 +1 @@
-v2.108.0-rc.1
+v2.108.0
index a00872ef864d4b863620b01d78a832e64fedf29a..dc47db87a80c8f1793d091c9eda6982763ee56aa 100644 (file)
@@ -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.
index eec6af92fef55b99298c1f2c060e6a62a326edaa..9df84893bb9e0a08b738846f7cc8d9b7aba5a98e 100644 (file)
@@ -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;
+    }
+}
index ff34bece2a3efcadd838068e739ef986d795ce9f..a4f25db810ed8f6b174c053a2fbf591a5828225b 100644 (file)
@@ -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.
index 6883d33adae7a128658ae9c385ca01aa78e208ac..167cf1bc6bce32e3e6f791b08b5d86be190a11b4 100644 (file)
@@ -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);
index 6aec366c657633abd08502701f892588b3d45c67..3f823013e650e891e243edf02c41ad72f055a5fe 100644 (file)
@@ -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")
                     {
index 5fac1c9cca440cffbfab4bc642cf454e088b75c7..460cd427ed0a3f7f5d7487180c131297aaeab925 100644 (file)
@@ -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.