aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-08-15 16:29:08 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2023-08-20 11:20:00 +0200
commitd77c280454cfba48ef38357145cecdabc8c1b05c (patch)
tree49e02afce6ab03a3405752c963b6ffb225012a40 /libphobos/src/std
parentce33bbfcbc7dd3afc6c96fb48a19ed00f0c598ce (diff)
downloadgcc-d77c280454cfba48ef38357145cecdabc8c1b05c.zip
gcc-d77c280454cfba48ef38357145cecdabc8c1b05c.tar.gz
gcc-d77c280454cfba48ef38357145cecdabc8c1b05c.tar.bz2
d: Merge upstream dmd, druntime 26f049fb26, phobos 330d6a4fd.
D front-end changes: - Import dmd v2.105.0-beta.1. - Added predefined version identifier VisionOS (ignored by GDC). - Functions can no longer have `enum` storage class. - The deprecation of the `body` keyword has been reverted, it is now an obsolete feature. - The error for `scope class` has been reverted, it is now an obsolete feature. D runtime changes: - Import druntime v2.105.0-beta.1. Phobos changes: - Import phobos v2.105.0-beta.1. - AliasSeq has been removed from std.math. - extern(C) getdelim and getline have been removed from std.stdio. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 26f049fb26. * dmd/VERSION: Bump version to v2.105.0-beta.1. * d-codegen.cc (get_frameinfo): Check useGC in condition. * d-lang.cc (d_handle_option): Set obsolete parameter when compiling with -Wall. (d_post_options): Set useGC to false when compiling with -fno-druntime. Propagate obsolete flag to compileEnv. * expr.cc (ExprVisitor::visit (CatExp *)): Check useGC in condition. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 26f049fb26. * src/MERGE: Merge upstream phobos 330d6a4fd.
Diffstat (limited to 'libphobos/src/std')
-rw-r--r--libphobos/src/std/algorithm/searching.d17
-rw-r--r--libphobos/src/std/bigint.d23
-rw-r--r--libphobos/src/std/json.d4
-rw-r--r--libphobos/src/std/math/package.d6
-rw-r--r--libphobos/src/std/stdio.d15
5 files changed, 43 insertions, 22 deletions
diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d
index f061915..37a08de 100644
--- a/libphobos/src/std/algorithm/searching.d
+++ b/libphobos/src/std/algorithm/searching.d
@@ -1528,6 +1528,23 @@ if (isInputRange!Range && !isInfinite!Range &&
assert([S(5), S(6)].extremum!"a.value" == S(5));
}
+// https://issues.dlang.org/show_bug.cgi?id=24027
+@safe nothrow unittest
+{
+ class A
+ {
+ int a;
+ this(int a)
+ {
+ this.a = a;
+ }
+ }
+
+ auto test = new A(5);
+ A[] arr = [test];
+ assert(maxElement!"a.a"(arr) is test);
+}
+
// find
/**
Finds an individual element in an $(REF_ALTTEXT input range, isInputRange, std,range,primitives).
diff --git a/libphobos/src/std/bigint.d b/libphobos/src/std/bigint.d
index 50f88da..0240ea1 100644
--- a/libphobos/src/std/bigint.d
+++ b/libphobos/src/std/bigint.d
@@ -323,7 +323,15 @@ public:
else static if (op=="^^")
{
sign = (y & 1) ? sign : false;
- data = BigUint.pow(data, u);
+ if (y < 0)
+ {
+ checkDivByZero();
+ data = cast(ulong) (data == 1);
+ }
+ else
+ {
+ data = BigUint.pow(data, u);
+ }
}
else static if (op=="&")
{
@@ -411,6 +419,19 @@ public:
));
}
+ // https://issues.dlang.org/show_bug.cgi?id=24028
+ @system unittest
+ {
+ import std.exception : assertThrown;
+ import core.exception : AssertError;
+
+ assert(BigInt(100) ^^ -1 == BigInt(0));
+ assert(BigInt(1) ^^ -1 == BigInt(1));
+ assert(BigInt(-1) ^^ -1 == BigInt(-1));
+ assert(BigInt(-1) ^^ -2 == BigInt(1));
+ assertThrown!AssertError(BigInt(0) ^^ -1);
+ }
+
/**
* Implements assignment operators of the form `BigInt op= BigInt`.
*/
diff --git a/libphobos/src/std/json.d b/libphobos/src/std/json.d
index 219af71..7d48890 100644
--- a/libphobos/src/std/json.d
+++ b/libphobos/src/std/json.d
@@ -6,6 +6,10 @@ Implements functionality to read and write JavaScript Object Notation values.
JavaScript Object Notation is a lightweight data interchange format commonly used in web services and configuration files.
It's easy for humans to read and write, and it's easy for machines to parse and generate.
+$(RED Warning: While $(LREF JSONValue) is fine for small-scale use, at the range of hundreds of megabytes it is
+known to cause and exacerbate GC problems. If you encounter problems, try replacing it with a stream parser. See
+also $(LINK https://forum.dlang.org/post/dzfyaxypmkdrpakmycjv@forum.dlang.org).)
+
Copyright: Copyright Jeremie Pelletier 2008 - 2009.
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: Jeremie Pelletier, David Herberth
diff --git a/libphobos/src/std/math/package.d b/libphobos/src/std/math/package.d
index 19982ec..b5f914a 100644
--- a/libphobos/src/std/math/package.d
+++ b/libphobos/src/std/math/package.d
@@ -168,12 +168,6 @@ public import std.math.rounding;
public import std.math.traits;
public import std.math.trigonometry;
-// @@@DEPRECATED_2.102@@@
-// Note: Exposed accidentally, should be deprecated / removed
-deprecated("std.meta.AliasSeq was unintentionally available from std.math "
- ~ "and will be removed after 2.102. Please import std.meta instead")
-public import std.meta : AliasSeq;
-
package(std): // Not public yet
/* Return the value that lies halfway between x and y on the IEEE number line.
*
diff --git a/libphobos/src/std/stdio.d b/libphobos/src/std/stdio.d
index 19ce988..d9291b1 100644
--- a/libphobos/src/std/stdio.d
+++ b/libphobos/src/std/stdio.d
@@ -425,21 +425,6 @@ private extern (C) @nogc nothrow
pragma(mangle, _FPUTWC.mangleof) int trustedFPUTWC(wchar_t ch, _iobuf* h) @trusted;
}
-static if (__traits(compiles, core.sys.posix.stdio.getdelim))
-{
- extern(C) nothrow @nogc
- {
- // @@@DEPRECATED_2.104@@@
- deprecated("To be removed after 2.104. Use core.sys.posix.stdio.getdelim instead.")
- ptrdiff_t getdelim(char**, size_t*, int, FILE*);
-
- // @@@DEPRECATED_2.104@@@
- // getline() always comes together with getdelim()
- deprecated("To be removed after 2.104. Use core.sys.posix.stdio.getline instead.")
- ptrdiff_t getline(char**, size_t*, FILE*);
- }
-}
-
//------------------------------------------------------------------------------
private struct ByRecordImpl(Fields...)
{