mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 02:44:18 +08:00
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.
This commit is contained in:
parent
06a7e7514a
commit
09992f8b88
@ -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.
|
||||
|
@ -1 +1 @@
|
||||
v2.108.0-rc.1
|
||||
v2.108.0
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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")
|
||||
{
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user