From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by sourceware.org (Postfix) with ESMTPS id F1DFB3858D33 for ; Sat, 6 Apr 2024 12:27:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1DFB3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=gdcproject.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gdcproject.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F1DFB3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=80.241.56.151 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712406460; cv=none; b=k0L3/yhRpQTHz1Js/FrXZuFDanivjzzTt3yY+2SHGQ0HJFWDh1w/sNwb9al8EL7zH6NE60H93eoh92gptA5oe3SkQSuyOpJwG5rzvbS4vAMesARLKc/QUmg8E5PseioTflY1cZ9k63sHq+/vLPheckL3G030v3P4Qjlzkr6O8wo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712406460; c=relaxed/simple; bh=5vEHILlHXzPzCFWOAnO8WbpkIqpSAtNuudPcFnYJ0Bc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=eQEsT7EHoL4UzBlJi4rpZwiCyxxYCDsXFzHUeT736l+CE9bciBpVAp3wuN3Km7YHXpxYh9lT8d4HTL7TddizwC1eHPrUtR843EQ1EUbwJSYJ1SzDkrLQLdjztwh7DfHCWKm+5csDKaoRME5OvQrt6ox/pMEqu94jphVlyZi2p88= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4VBZPJ2cmsz9slH; Sat, 6 Apr 2024 14:27:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gdcproject.org; s=MBO0001; t=1712406452; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=WGqOFvk9K2U0fW2rJvc4mMI2uXpuGHDhnCWXsnCwhsQ=; b=c+++BdixG745+d2S2sHi+VLpMgvPkPE76N/dbl80CTH7uI3tmdIWlVgXLTv949cHcvXc0p 7x8xIkvP70eyoJvSkfLaTu5JjSLNDV4qGkuiyefl8NXnH+xolUfV45ZP9KFEtajGHIGnpj sAdyWenstOEDWYnY1ojJKjCmrDACW9DYMh7aQPBNoBDPPdKwwTA/FZFH7l6Cyd8oNdEUod hX5un00yQiPufPdIHwGqkmKB9hGhY35QqPGRBM1tmimTsNs8pZCIRYDKMWwd9mZQHRtTY+ z4wWI3YcOaoA9hxXSp9Qgrraapx1TXPua77AVJyEQ2irWC1KACRsf8ykeDMx8Q== From: Iain Buclaw To: gcc-patches@gcc.gnu.org Cc: Iain Buclaw Subject: [committed] d: Merge upstream dmd, druntime b65767825f, phobos 92dc5a4e9. Date: Sat, 6 Apr 2024 14:27:29 +0200 Message-Id: <20240406122729.48487-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4VBZPJ2cmsz9slH X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_LOTSOFHASH,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 --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. -- 2.40.1