diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-07-10 17:16:17 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-07-10 23:31:29 +0200 |
commit | e9251fea2debebfebe1f762a4a8d5b3b1d4c75ef (patch) | |
tree | 09b47f4d760019131aa27d19bfb8e5ee0f1ed31f /libphobos/src/std/algorithm | |
parent | 2d7c95e31431a297060c94697af84f498abf97a2 (diff) | |
download | gcc-e9251fea2debebfebe1f762a4a8d5b3b1d4c75ef.zip gcc-e9251fea2debebfebe1f762a4a8d5b3b1d4c75ef.tar.gz gcc-e9251fea2debebfebe1f762a4a8d5b3b1d4c75ef.tar.bz2 |
d: Merge upstream dmd, druntime a88e1335f7, phobos 1921d29df.
D front-end changes:
- Import dmd v2.104.1.
- Deprecation phase ended for access to private method when
overloaded with public method.
D runtime changes:
- Import druntime v2.104.1.
- Linux input header translations were added to druntime.
- Integration with the Valgrind `memcheck' tool has been added
to the garbage collector.
Phobos changes:
- Import phobos v2.104.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd a88e1335f7.
* dmd/VERSION: Bump version to v2.104.1.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime a88e1335f7.
* src/MERGE: Merge upstream phobos 1921d29df.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac (libphobos-checking): Add valgrind flag.
(DRUNTIME_LIBRARIES_VALGRIND): Call.
* libdruntime/Makefile.am (DRUNTIME_CSOURCES): Add
etc/valgrind/valgrind_.c.
(DRUNTIME_DSOURCES): Add etc/valgrind/valgrind.d.
(DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/input.d,
core/sys/linux/input_event_codes.d, core/sys/linux/uinput.d.
* libdruntime/Makefile.in: Regenerate.
* m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_VALGRIND): Define.
Diffstat (limited to 'libphobos/src/std/algorithm')
-rw-r--r-- | libphobos/src/std/algorithm/iteration.d | 4 | ||||
-rw-r--r-- | libphobos/src/std/algorithm/mutation.d | 2 | ||||
-rw-r--r-- | libphobos/src/std/algorithm/searching.d | 48 |
3 files changed, 23 insertions, 31 deletions
diff --git a/libphobos/src/std/algorithm/iteration.d b/libphobos/src/std/algorithm/iteration.d index 55ccb51..39927be 100644 --- a/libphobos/src/std/algorithm/iteration.d +++ b/libphobos/src/std/algorithm/iteration.d @@ -2026,7 +2026,7 @@ private struct ChunkByGroup(alias eq, Range, bool eqEquivalenceAssured) } } - // Cannot be a copy constructor due to issue 22239 + // Cannot be a copy constructor due to https://issues.dlang.org/show_bug.cgi?id=22239 this(this) @trusted { import core.lifetime : emplace; @@ -2128,7 +2128,7 @@ if (isForwardRange!Range) }(); } - // Cannot be a copy constructor due to issue 22239 + // Cannot be a copy constructor due to https://issues.dlang.org/show_bug.cgi?id=22239 this(this) @trusted { import core.lifetime : emplace; diff --git a/libphobos/src/std/algorithm/mutation.d b/libphobos/src/std/algorithm/mutation.d index 9b1d920..61b6a5e 100644 --- a/libphobos/src/std/algorithm/mutation.d +++ b/libphobos/src/std/algorithm/mutation.d @@ -3049,7 +3049,7 @@ if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs)))) swap(b1, b2); } -// issue 20732 +// https://issues.dlang.org/show_bug.cgi?id=20732 @safe unittest { static struct A diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d index ee318c8..f061915 100644 --- a/libphobos/src/std/algorithm/searching.d +++ b/libphobos/src/std/algorithm/searching.d @@ -1282,7 +1282,7 @@ if (isInputRange!R && @safe pure unittest { - //example from issue 19727 + //example from https://issues.dlang.org/show_bug.cgi?id=19727 import std.path : asRelativePath; string[] ext = ["abc", "def", "ghi"]; string path = "/foo/file.def"; @@ -1315,19 +1315,12 @@ in } do { - import std.typecons : Rebindable; + import std.typecons : Rebindable2; alias Element = ElementType!Range; - Rebindable!Element seed = r.front; + auto seed = Rebindable2!Element(r.front); r.popFront(); - static if (is(Rebindable!Element == T[], T)) - { - return extremum!(map, selector)(r, seed); - } - else - { - return extremum!(map, selector)(r, seed.get); - } + return extremum!(map, selector)(r, seed.get); } private auto extremum(alias map, alias selector = "a < b", Range, @@ -1337,25 +1330,24 @@ if (isInputRange!Range && !isInfinite!Range && !is(CommonType!(ElementType!Range, RangeElementType) == void) && is(typeof(unaryFun!map(ElementType!(Range).init)))) { - import std.typecons : Rebindable; + import std.typecons : Rebindable2; alias mapFun = unaryFun!map; alias selectorFun = binaryFun!selector; alias Element = ElementType!Range; alias CommonElement = CommonType!(Element, RangeElementType); - Rebindable!CommonElement extremeElement = seedElement; + auto extremeElement = Rebindable2!CommonElement(seedElement); // if we only have one statement in the loop, it can be optimized a lot better static if (__traits(isSame, map, a => a)) { - // direct access via a random access range is faster static if (isRandomAccessRange!Range) { foreach (const i; 0 .. r.length) { - if (selectorFun(r[i], extremeElement)) + if (selectorFun(r[i], extremeElement.get)) { extremeElement = r[i]; } @@ -1365,7 +1357,7 @@ if (isInputRange!Range && !isInfinite!Range && { while (!r.empty) { - if (selectorFun(r.front, extremeElement)) + if (selectorFun(r.front, extremeElement.get)) { extremeElement = r.front; } @@ -1376,7 +1368,7 @@ if (isInputRange!Range && !isInfinite!Range && else { alias MapType = Unqual!(typeof(mapFun(CommonElement.init))); - MapType extremeElementMapped = mapFun(extremeElement); + MapType extremeElementMapped = mapFun(extremeElement.get); // direct access via a random access range is faster static if (isRandomAccessRange!Range) @@ -1405,15 +1397,7 @@ if (isInputRange!Range && !isInfinite!Range && } } } - // Rebindable is an alias to T for arrays - static if (is(typeof(extremeElement) == T[], T)) - { - return extremeElement; - } - else - { - return extremeElement.get; - } + return extremeElement.get; } private auto extremum(alias selector = "a < b", Range)(Range r) @@ -2309,7 +2293,7 @@ private R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, scope R2 needle) @safe: string _impl; - // This is what triggers issue 7992. + // This is what triggers https://issues.dlang.org/show_bug.cgi?id=7992. @property size_t length() const { return _impl.length; } @property void length(size_t len) { _impl.length = len; } @@ -2322,7 +2306,7 @@ private R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, scope R2 needle) @property CustomString save() { return this; } } - // If issue 7992 occurs, this will throw an exception from calling + // If https://issues.dlang.org/show_bug.cgi?id=7992 occurs, this will throw an exception from calling // popFront() on an empty range. auto r = find(CustomString("a"), CustomString("b")); assert(r.empty); @@ -3880,6 +3864,14 @@ if (isInputRange!Range && !isInfinite!Range && assert(arr.maxElement!"a.val".val == 1); } +// https://issues.dlang.org/show_bug.cgi?id=23993 +@safe unittest +{ + import std.bigint : BigInt; + + assert([BigInt(2), BigInt(3)].maxElement == BigInt(3)); +} + // minPos /** Computes a subrange of `range` starting at the first occurrence of `range`'s |