Commit graph

16444 commits

Author SHA1 Message Date
RubyTheRoobster
cd026126db
Issue 24095 - std.bitmanip.bitfields no longer works with bool enum t… (#9043)
* Fix Bugzilla Issue 24095 - std.bitmanip.bitfields no longer works with bool enum types

* Fix trailing whitespace

* Remove extra space
2024-08-19 15:05:36 +03:00
Luis Ferreira
9c11552ac2
Fix issue 24686: SumType stopped working with unmatched DeducedParameterType template 2024-08-03 11:53:46 +02:00
Bastiaan Veelo
4b61e7dd55
Fix sharedLog assignment. (#8995)
* Allow `new shared FileLogger()`

* Address review comment

* Update documentation.

Fix Bugzilla 23487 - std.experimental.logger assigning FileLogger to sharedLog no longer works

* Comment on `trusted` section.

---------

Co-authored-by: Atila Neves <atila.neves@gmail.com>
2024-07-22 06:47:38 +08:00
Dennis Korpel
312a86d741 Mark std.math.exponential.pow @safe 2024-07-01 01:20:46 +02:00
0-v-0
42e2caa5c0 Improve code readablitity in unittests 2024-06-21 18:35:03 +02:00
Dennis
b5d94743f3
Merge pull request #9007 from pbackus/improve-sumtype-examples
Improve std.sumtype examples
2024-06-17 12:01:00 +02:00
Nick Treleaven
beeed12c06 Fix assigning const(void)[] to void[]
Needed for https://github.com/dlang/dmd/pull/16583.
2024-06-16 08:57:24 +02:00
Iain Buclaw
7ff7b842a8 Merge remote-tracking branch 'upstream/stable' into merge_stable 2024-06-15 22:33:30 +00:00
FeepingCreature
539dc473ba
Fix bugzilla issue 24596: std.typecons.Rebindable2: Don't destroy classes! Only destroy structs! (#9012) 2024-06-10 23:10:18 +08:00
Nick Treleaven
ad9f87d1b8 [std.bitmanip] Make 3 examples runnable 2024-06-04 00:53:04 +02:00
Nick Treleaven
ccd3115b8b [std.regex] Fix unsafe casts to bool
These are disallowed in `@safe` code with
https://github.com/dlang/dmd/pull/16558.
2024-06-03 16:27:09 +02:00
Paul Backus
ed91e50deb sumtype: add list of examples to module doc
This will hopefully make it easier for readers to notice that all of
these examples exist.
2024-05-31 11:22:43 -04:00
Paul Backus
1aa99f8e3f sumtype: rename arithmetic evaluator example 2024-05-31 11:22:43 -04:00
Paul Backus
d1dfd094f4 sumtype: add overload-set matching example
This is a useful technique, and non-obvious enough that other D
community members were surprised when I showed it to them.

The unusual formatting and code layout used here achieves the following
goals:

1. Have this example appear below "Basic usage".
2. Have the overload set appear as it would at module level.
3. Have as much of the example code unit-tested as possible.

Goal (2), in particular, rules out the use of a "wrapper" struct to
create an overload set of static methods, which is the technique that's
normally used to include an overload set in a unittest block.
2024-05-31 11:22:43 -04:00
Paul Backus
e13bd7dec6 sumtype: remove match-by-introspection example
This technique has turned out not to be very useful in practice, and the
example is a bit subtle and tricky to understand. Removing it will make
room for more useful and less confusing examples.
2024-05-31 00:08:44 -04:00
Iain Buclaw
3a59a5a7cf Merge remote-tracking branch 'upstream/stable' into merge_stable 2024-05-27 09:41:34 +00:00
Martin Kinkelin
acd2013413 Get rid of obsolete CRuntime_DigitalMars support 2024-05-25 21:45:49 +02:00
Nick Treleaven
38fa9c3294 Fix Bugzilla 24564 - std.file.DirEntry throws Exception instead of FileException 2024-05-25 00:50:58 +02:00
Ben Jones
2133b68234 fix goto skipping over declaration 2024-05-20 14:18:50 -06:00
Steven Schveighoffer
82e8e32b2f Fix bugzilla issue 24549 -- environment.get(null) segfaults on Linux 2024-05-16 20:09:04 +02:00
WANG Rui
1a8d2eae06 std/math/hardware.d: Fix compile error for LoongArch
```
std/math/hardware.d(187):1:19: error: invalid operand for instruction
        movfcsr2gr $a0, $r2
```
2024-05-09 14:26:40 +02:00
Iain Buclaw
ee136a95d8 Merge remote-tracking branch 'upstream/stable' into merge_stable 2024-05-03 17:17:50 +00:00
Bastiaan Veelo
c970ca67f2 Fix documentation typos. 2024-05-02 01:54:11 +02:00
dokutoku
9a8325ca5f
Fix some invalid links (#8994)
Co-authored-by: dokutoku <3729541-dokutoku@users.noreply.gitlab.com>
2024-04-29 22:08:10 +08:00
Jonathan M Davis
ffe00ebdc3 Fix bugzilla issue 24481: retro stopped working
In an attempt make it so that non-copyable types worked with some of the
functions in std/range/package.d, they were made to use moves instead of
assignment, which broke the code for types which work with assignment
but not moves (which affected the folks at Weka).

The code checked for assignment but not whether move could be used, and
that didn't change when the code was changed to use move, meaning that
the checks didn't match what the code was actually doing.

So, to support both the non-copyable types and the ones that can be
assigned to but not moved to, this changes the code to use
core.lifetime.forward which will move the argument if it can and assign
otherwise. So ,the code that worked previously should work again, and
the newer functionality of being able to use non-copyable types with
this code should continue to work.

Discussion here: https://github.com/dlang/phobos/pull/8721
2024-04-29 11:33:30 +02:00
Dennis
8e6f77231a
Merge pull request #8989 from chloekek/std.process.Config.preExecFunction-delegate
Promote `std.process.Config.preExecFunction` to a delegate
2024-04-28 23:01:54 +02:00
chloekek
7a280a938e Add std.process.Config.preExecDelegate
std.process.Config.preExecDelegate is just like
std.process.Config.preExecFunction, but can capture an environment, for
example:

    import core.sys.linux.sys.prctl : PR_SET_PDEATHSIG, prctl;
    import std.process : Config, execute;

    void runProgram(int pdeathsig)
    {
        execute(
            ["program"],
            config: Config(
                preExecDelegate: () @trusted =>
                    prctl(PR_SET_PDEATHSIG, pdeathsig, 0, 0, 0) != -1,
            ),
        );
    }

preExecFunction is retained for backwards compatibility. If both
preExecFunction and preExecDelegate are given, both are called.
2024-04-26 12:38:38 +02:00
chloekek
5ce5344593 Promote std.process.Config.preExecFunction to a delegate
std.process.Config.preExecFunction is now a delegate instead of a function
pointer, and can therefore capture an environment, for example:

    import core.sys.linux.sys.prctl : PR_SET_PDEATHSIG, prctl;
    import std.process : Config, execute;

    void runProgram(int pdeathsig)
    {
        execute(
            ["program"],
            config: Config(
                preExecFunction: () @trusted =>
                    prctl(PR_SET_PDEATHSIG, pdeathsig, 0, 0, 0) != -1,
            ),
        );
    }

Despite function pointers implicitly converting to delegates, this is a
backwards-incompatible change, as user code may rely on the field being a
function pointer. For example, code like the following will no longer compile:

    import std.process : Config;

    nothrow pure @nogc @safe
    bool f() { return true; }

    void example()
    {
        auto config = Config(preExecFunction: &f);
        bool function() g = config.preExecFunction;
    }
2024-04-26 01:13:56 +02:00
Iain Buclaw
688816eb41 Merge remote-tracking branch 'upstream/stable' into merge_stable 2024-04-25 19:11:41 +00:00
0-v-0
4b2ea30979 Remove std.conv import from createStorageAndFields 2024-04-22 22:29:22 +08:00
Dennis
e669d3ec6c
Merge pull request #8985 from dkorpel/bigint-remove-subsimple
std.bigint: remove subSimple
2024-04-22 11:39:57 +02:00
Dennis Korpel
a92d08bcfc std.bigint: remove subSimple 2024-04-19 23:54:27 +02:00
Inkrementator
72832ab8a4 Remove test with bugreport from the online documentation 2024-04-19 17:34:19 +02:00
Inkrementator
7b05ce70cc Correct Link formatting 2024-04-19 17:18:41 +02:00
Inkrementator
ffe309b065 Remove resolved bug from exmaples
https://issues.dlang.org/show_bug.cgi?id=24064 is resolved
2024-04-19 17:16:18 +02:00
Nick Treleaven
7740a857f3 [std/net/isemail] Fix foreach ref index
See https://github.com/dlang/dmd/pull/16381.
2024-04-17 11:45:35 +02:00
Dennis Korpel
80235ea056 Add @nogc nothrow to randomUUID 2024-04-17 11:27:06 +02:00
Nick Treleaven
655a1e4d1f Fix ref foreach range variable
See https://github.com/dlang/dmd/pull/16381.
2024-04-14 18:17:29 +01:00
Jonathan M Davis
34ff27e58d Work around bugzilla issue 24415 - only doesn't work with elements with a copy constructor.
Since the compiler is treating the auto-generated copy-constructor for
OnlyResult as private (thus rendering it useless outside of
std.range.package), this commit adds an explicit one and makes it
public. Once the dmd bug has been fixed, the explicit copy constructor
should be removed.
2024-04-09 09:08:12 +02:00
Dennis Korpel
08b6dd3f7a Fix bugzilla 24478 - std.csv array out of bounds when row size exceeds header 2024-04-02 21:28:26 +02:00
Dennis Korpel
8729740e32 Mark endianToNativeImpl @trusted 2024-04-02 17:16:37 +08:00
Iain Buclaw
045b632950 Merge remote-tracking branch 'upstream/stable' into merge_stable 2024-04-01 20:59:13 +00:00
Jonathan M Davis
7858069343 Fix bugzilla #24465: Make Tuple work with copy constructors
If there's a constructor that looks like a copy constructor except that
it takes an rvalue instead of taking the argument by ref, then that type
can't have a copy constructor, and one of Tuple's constructors was
causing that problem. So, this fixes it so that it doesn't.
2024-04-01 20:15:25 +02:00
Johan Engelen
9f735fd8bf Fix alignment of buffers in kernighan_ritchie unittests. 2024-04-01 20:15:04 +02:00
Nick Treleaven
14b23633b7 [std.traits] Improve FunctionTypeOf docs 2024-04-01 05:52:13 +08:00
MrcSnm
4d332baad1 Fix Bugzilla Issue 24458 - Mac M3 associative array keys on std.net.curl gets overwritten 2024-03-31 15:57:18 -03:00
MrcSnm
afb0b3485b Fix Bugzilla Issue 24458 - Mac M3 associative array keys on std.net.curl gets overwritten 2024-03-30 08:47:50 -03:00
liushuyu
676710c7b8 std/math/hardware.d: use an alternative register naming ...
... for LoongArch64 so that LDC/LLVM can recognize certain fp
instructions
2024-03-23 23:38:07 +01:00
Horodniceanu Andrei
b2853536e9
std/file.d: Don't check for OS-dependent error message in unittest
Signed-off-by: Horodniceanu Andrei <a.horodniceanu@proton.me>
2024-03-22 09:18:42 +02:00
Walter Bright
41716f8f45
Merge pull request #8950 from WalterBright/swapAndDestroy
swap-and-destroy called too eagerly
2024-03-19 22:48:34 -07:00