aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2025-01-06 23:11:02 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2025-01-11 00:51:15 +0100
commitc82395e03592e5858c34f0b824f494eb94b37404 (patch)
tree8fddc3a6b179866de8e4950888cef1c6b4e834a5 /libphobos/src
parenta7ae0c31245a7db7abf2e80d0016510afe9c8ad0 (diff)
downloadgcc-c82395e03592e5858c34f0b824f494eb94b37404.zip
gcc-c82395e03592e5858c34f0b824f494eb94b37404.tar.gz
gcc-c82395e03592e5858c34f0b824f494eb94b37404.tar.bz2
d: Merge dmd, druntime 4ccb01fde5, phobos eab6595ad
D front-end changes: - Added pragma for ImportC to allow setting `nothrow', `@nogc' or `pure'. - Mixin templates can now use assignment syntax. D runtime changes: - Removed `ThreadBase.criticalRegionLock' from `core.thread'. - Added `expect', `[un]likely', `trap' to `core.builtins'. Phobos changes: - Import latest fixes from phobos v2.110.0-beta.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 4ccb01fde5. * Make-lang.in (D_FRONTEND_OBJS): Rename d/foreachvar.o to d/visitor-foreachvar.o, d/visitor.o to d/visitor-package.o, and d/statement_rewrite_walker.o to d/visitor-statement_rewrite_walker.o. (D_FRONTEND_OBJS): Rename d/{parsetime,permissive,postorder,transitive}visitor.o to d/visitor-{parsetime,permissive,postorder,transitive}.o. (D_FRONTEND_OBJS): Remove d/sapply.o. (d.tags): Add dmd/common/*.h. (d/visitor-%.o:): New rule. * d-codegen.cc (get_frameinfo): Update for new front-end interface. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 4ccb01fde5. * src/MERGE: Merge upstream phobos eab6595ad.
Diffstat (limited to 'libphobos/src')
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/std/algorithm/sorting.d20
-rw-r--r--libphobos/src/std/format/package.d12
-rw-r--r--libphobos/src/std/format/write.d2
-rw-r--r--libphobos/src/std/uni/package.d6
5 files changed, 29 insertions, 13 deletions
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 4fac724..8daeda5 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-48d581a1f509a7a302ea893e28939edb5b130622
+eab6595ade1dab9a757bc0efe2f4e92f39cab0f7
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/algorithm/sorting.d b/libphobos/src/std/algorithm/sorting.d
index 2d16c65..cb47153 100644
--- a/libphobos/src/std/algorithm/sorting.d
+++ b/libphobos/src/std/algorithm/sorting.d
@@ -2385,7 +2385,11 @@ private template TimSortImpl(alias pred, R)
size_t stackLen = 0;
// Allocate temporary memory if not provided by user
- if (temp.length < minTemp) temp = () @trusted { return uninitializedArray!(T[])(minTemp); }();
+ if (temp.length < minTemp)
+ {
+ static if (hasElaborateAssign!T) temp = new T[](minTemp);
+ else temp = () @trusted { return uninitializedArray!(T[])(minTemp); }();
+ }
for (size_t i = 0; i < range.length; )
{
@@ -3076,6 +3080,20 @@ private template TimSortImpl(alias pred, R)
array.sort!("a < b", SwapStrategy.stable);
}
+// https://issues.dlang.org/show_bug.cgi?id=24773
+@safe unittest
+{
+ static struct S
+ {
+ int i = 42;
+ ~this() { assert(i == 42); }
+ }
+
+ auto array = new S[](400);
+ array.sort!((a, b) => false, SwapStrategy.stable);
+}
+
+
// schwartzSort
/**
Alternative sorting method that should be used when comparing keys involves an
diff --git a/libphobos/src/std/format/package.d b/libphobos/src/std/format/package.d
index a78e1b3..e02c120 100644
--- a/libphobos/src/std/format/package.d
+++ b/libphobos/src/std/format/package.d
@@ -60,7 +60,7 @@ Limitation: This package does not support localization, but
adheres to the rounding mode of the floating point unit, if
available.
-$(SECTION3 Format Strings)
+$(H3 $(LNAME2 format-strings, Format Strings))
The functions contained in this package use $(I format strings). A
format string describes the layout of another string for reading or
@@ -144,7 +144,7 @@ recommended to assign (lower- and uppercase) letters.
Note: The $(I Parameters) of a $(I CompoundIndicator) are currently
limited to a $(B '-') flag.
-$(SECTION4 Format Indicator)
+$(H4 $(LNAME2 format-indicator, Format Indicator))
The $(I format indicator) can either be a single character or an
expression surrounded by $(B %\() and $(B %\)). It specifies the
@@ -205,7 +205,7 @@ Note: Inside a $(I compound indicator), strings and characters are
escaped automatically. To avoid this behavior, use `"%-$(LPAREN)"`
instead of `"%$(LPAREN)"`.
-$(SECTION4 Flags)
+$(H4 $(LNAME2 flags, Flags))
There are several flags that affect the outcome of the formatting.
@@ -244,7 +244,7 @@ $(BOOKTABLE ,
sections below for more information.))
)
-$(SECTION4 Width$(COMMA) Precision and Separator)
+$(H4 $(LNAME2 width-precision-separator, Width, Precision and Separator))
The $(I width) parameter specifies the minimum width of the result.
@@ -269,7 +269,7 @@ The $(I separator) can also be followed by a $(B '?'). In that case,
an additional argument is used to specify the symbol that should be
used to separate the chunks.
-$(SECTION4 Position)
+$(H4 $(LNAME2 position, Position))
By default, the arguments are processed in the provided order. With
the $(I position) parameter it is possible to address arguments
@@ -282,7 +282,7 @@ It's also possible to use positional arguments for $(I width), $(I
precision) and $(I separator) by adding a number and a $(B
'$(DOLLAR)') after the $(B '*').
-$(SECTION4 Types)
+$(H4 $(LNAME2 types, Types))
This section describes the result of combining types with format
characters. It is organized in 2 subsections: a list of general
diff --git a/libphobos/src/std/format/write.d b/libphobos/src/std/format/write.d
index 2aa45d7..078fa78 100644
--- a/libphobos/src/std/format/write.d
+++ b/libphobos/src/std/format/write.d
@@ -28,7 +28,7 @@ $(TR $(TD $(I delegates)) $(TD yes) $(TD $(MDASH)) $(TD $(MDASH)) $(TD $(MDASH))
Enums can be used with all format characters of the base type.
-$(SECTION3 Structs$(COMMA) Unions$(COMMA) Classes$(COMMA) and Interfaces)
+$(H3 $(LNAME2 aggregates, Structs, Unions, Classes, and Interfaces))
Aggregate types can define various `toString` functions. If this
function takes a $(REF_ALTTEXT FormatSpec, FormatSpec, std, format,
diff --git a/libphobos/src/std/uni/package.d b/libphobos/src/std/uni/package.d
index b6d31a8..f7610c0 100644
--- a/libphobos/src/std/uni/package.d
+++ b/libphobos/src/std/uni/package.d
@@ -7005,7 +7005,7 @@ private enum TransformRes
// Note, getting GB1 (break at start of text, unless text is empty) right
// relies on the user starting grapheme walking from beginning of the text, and
// not attempting to walk an empty text.
-private enum TransformRes
+private immutable TransformRes
function(ref GraphemeState, dchar) @safe pure nothrow @nogc [] graphemeTransforms =
[
GraphemeState.Start: (ref state, ch)
@@ -7243,9 +7243,7 @@ if (is(C : dchar))
static assert(c2 == 3); // \u0301 has 2 UTF-8 code units
}
-// TODO: make this @nogc. Probably no big deal since the state machine is
-// already GC-free.
-@safe pure nothrow unittest
+@safe pure nothrow @nogc unittest
{
// grinning face ~ emoji modifier fitzpatrick type-5 ~ grinning face
assert(graphemeStride("\U0001F600\U0001f3FE\U0001F600"d, 0) == 2);