diff options
| author | Iain Buclaw <ibuclaw@gdcproject.org> | 2024-04-06 14:14:11 +0200 |
|---|---|---|
| committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2024-04-06 14:26:37 +0200 |
| commit | 09992f8b881aa2dfbee1e9d6954c3ca90cd3fe41 (patch) | |
| tree | 9797d4558fcf72ad26e15365b3650fc886ff52b4 /libphobos/src | |
| parent | 06a7e7514af67d9f3c51fe7a592b5166da791e2f (diff) | |
d: Merge upstream dmd, druntime b65767825f, 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.
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.
Diffstat (limited to 'libphobos/src')
| -rw-r--r-- | libphobos/src/MERGE | 2 | ||||
| -rw-r--r-- | libphobos/src/std/experimental/allocator/building_blocks/kernighan_ritchie.d | 4 | ||||
| -rw-r--r-- | libphobos/src/std/net/curl.d | 5 | ||||
| -rw-r--r-- | libphobos/src/std/typecons.d | 47 |
4 files changed, 53 insertions, 5 deletions
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. |
