Commit graph

19551 commits

Author SHA1 Message Date
Brian Callahan
8a42656f67 Fix Issue 22416 - Unify polyImpl implementations 2021-10-18 05:40:34 +00:00
Andrei Alexandrescu
901ef54b7f Iterative maxAlignment 2021-10-17 23:59:46 -04:00
The Dlang Bot
5bcd231c33
Merge pull request #8285 from ibara/stable
OpenBSD: Add polyImpl implementation for x86

Signed-off-by: Iain Buclaw <ibuclaw@users.noreply.github.com>
Merged-on-behalf-of: Martin Kinkelin <kinke@users.noreply.github.com>
2021-10-18 00:17:47 +00:00
Andrei Alexandrescu
4aaffaf256 Simpler Template*Of 2021-10-17 18:28:21 +00:00
Andrei Alexandrescu
d2c6766dda Iterative Largest 2021-10-17 12:32:43 -04:00
Brian Callahan
78d152bedb Bump HOST_DMD_VER to 2.095.0 as requested in #8285 2021-10-17 11:51:46 -04:00
Andrei Alexandrescu
cee36efec4 Simplify and generalize allSameType 2021-10-17 12:14:48 +00:00
Vladimir Panteleev
461101dfa0 Fix Issue 22394 - std.getopt cannot handle "-" 2021-10-17 01:48:51 +00:00
Andrei Alexandrescu
f5c15d8469 [TRIVIAL] Simpler CommonType 2021-10-16 14:25:32 -04:00
Brian Callahan
36eeb42292 OpenBSD: Add polyImpl implementation for x86
Fix Issue 22393 - OpenBSD: Add polyImpl implementation for x86
2021-10-16 08:05:02 -04:00
John Colvin
dc69783cfb @safe tests in std.uni 2021-10-15 11:30:04 +00:00
Per Nordlöw
dd310f3543 Use string compile-time concatenation assigned to enums then passed to put()
Reverts https://github.com/dlang/phobos/pull/8277/files.
2021-10-15 09:16:21 +00:00
Nathan Sashihara
ebdc9a8975 Alter AMD RDAND bug detection to reduce bias against -1 in unpredictableSeed
Before this PR if RDRAND was working the chance of unpredictableSeed
returning -1 was 2^^-64 instead of the expected 2^^-32. Now the chance
is 2^^-32 - 2^^-64 + 2^^-96.
2021-10-15 02:54:11 +00:00
Petar Kirov
5cf43c23ff Delete outdated comment
As per https://github.com/dlang/phobos/pull/8276#discussion_r729390034.
2021-10-15 00:14:13 +00:00
MoonlightSentinel
c95d013d8e Fix 22370 - Accept noreturn callables in std.concurrency.spawn[Linked]
`spawn[Linked]` required the passed callable to return `void`. This is
unecessarily strict because both `void` and `noreturn` imply that no
actual value will be returned by the callable.
2021-10-14 18:49:49 +00:00
Per Nordlöw
0812f7a4e0 Avoid string concatenations in put() calls to avoid GC allocations 2021-10-14 18:26:14 +00:00
MoonlightSentinel
bb2b31f892 Fix 22383 - Reject noreturn[] as an autodecodable string
`noreturn[]` does not contain characters and hence is not subject to
autodecoding. The previous behaviour caused the range primitives (`put`,
...) to call into autodecoding related functions which couldn't handle
`noreturn[]`.
That error caused `isInputRange!(noreturn[])` to yield false.
2021-10-14 17:23:16 +00:00
MoonlightSentinel
fc500c2ccd Fix 22386 - Omit unreachable throw in assertThrown with noreturn value
The lazy value will throw or never return at all and hence never
reach the additional throw statement.
2021-10-14 15:40:57 +00:00
Ate Eskola
dadfd00b5e Added a comment about the invariant of respecting stripped qualifiers. 2021-10-14 16:14:59 +03:00
Razvan Nitu
4130a1176c
Merge pull request #8270 from MoonlightSentinel/noreturn/castswitch
Fix 22384 - Treat noreturn handlers like void in castSwitch
2021-10-14 11:49:28 +03:00
Andrei Alexandrescu
4b3e8a9214
Merge pull request #8045 from andralex/staticSort
Improve staticSort by using some ctfe instead of template recursion
2021-10-13 17:45:47 -04:00
Andrei Alexandrescu
31ca51e9c1 Improve staticSort by using some ctfe instead of template recursion 2021-10-13 16:32:20 -04:00
Ate Eskola
769299f70b Fix issue 21022 - only should work with qualifiers 2021-10-13 21:32:33 +03:00
Razvan Nitu
d8e91d147c
Merge pull request #8269 from dukc/simplifyOnly
Swapped out custom empty `only` for a simpler empty array.
2021-10-13 21:29:18 +03:00
Razvan Nitu
a2a9a8d5d4
Merge pull request #8266 from MoonlightSentinel/noreturn/concurrency
Fix 22369 - Omit unreachable statements in std.concurrency
2021-10-13 21:18:33 +03:00
MoonlightSentinel
3e70aac3ae
Fix 22384 - Treat noreturn handlers like void in castSwitch
The previous check assumed that non-`void` return implies a returned
value - which obviously does not apply for `noreturn`.
Further code then assumed that `void` handlers should throw an exception
and hence threw an error when it didn't throw.
2021-10-13 17:35:11 +02:00
Ate Eskola
dc15745a4a Swapped out custom empty only for a simpler empty array. 2021-10-13 17:59:56 +03:00
MoonlightSentinel
4cf70e6c43
Fix 22369 - Omit unreachable statements in std.concurrency
Instantiating these templates with noreturn values / callbacks causes
the versioned statements to become unreachable.
2021-10-13 15:26:14 +02:00
Martin Nowak
05236f7c2d
purge changelog (#8267) 2021-10-11 07:11:35 +08:00
Martin Nowak
b114d3f1a1 purge changelog 2021-10-10 14:43:10 +02:00
Razvan Nitu
2f5008ab89
Merge pull request #8263 from adamdruppe/bug_22359
Fix issue #22359 - joiner over an empty class range liable to segfault
2021-10-09 12:17:53 +03:00
Razvan Nitu
94470ba523
Merge pull request #8265 from MoonlightSentinel/noreturn/traits
Fix 22368 - has[Unshared]Aliasing fails to instantiate for noreturn
2021-10-09 12:11:05 +03:00
MoonlightSentinel
b612caa162
Fix 22368 - has[Unshared]Aliasing fails to instantiate for noreturn
The problem was that `noreturn` matched the special case for `Rebindable`
because the bottom type is implicitly convertible to any type.
2021-10-08 19:23:04 +02:00
MoonlightSentinel
1c8047bc6d Fix 22364 - Omit unreachable return in collectException[Msg]...
...when instantiated with `noreturn`.

DMD is able to determine that a lazy `noreturn` expression will interrupt
the normal control flow (throw / halt / ...) s.t. it never reaches the
`return`.
2021-10-08 11:49:48 +00:00
Razvan Nitu
12b43809a3
Merge pull request #8162 from DoctorNoobingstoneIPresume/210709_std_container_array_Payload_DefaultConstruct_01h
std.container.Array: Payload "default constructor" simplifies Array.
2021-10-08 14:46:56 +03:00
Adam D. Ruppe
ff6920bd8a Fix issue #22359 - joiner over an empty forward range object liable to segfault
If you pass it a range of class-based ranges, the initialization to
`typeof(_current).init` will be `null`. Calling the `save` method
on `null` will naturally be a memory violation. This generic check
will handle null without harming any other type since save of any
init value will be another init value.
2021-10-07 10:34:35 -04:00
Razvan Nitu
14b750f0bc
Merge pull request #8256 from pbackus/fix-19544
Fix issue 19544 - Can't call inputRangeObject on ranges not supported by …
2021-10-05 12:32:57 +03:00
Paul Backus
3ad8dbd41c Check return value of 'open' in std.process test
Previously, if this call to 'open' failed, it would result in a spurious
test failure. Now, it instead causes the test to be skipped.

Possibly related to https://issues.dlang.org/show_bug.cgi?id=22350
2021-10-03 22:35:00 +00:00
Paul Backus
2cb2d6cd67 Refactor std.traits.EnumMembers 2021-10-03 22:13:35 +00:00
Paul Backus
b7ef267ab4 Replace FieldProxy with @property ref functions
This simplifies the code and removes the need for a separate
version (StdDdoc) block.
2021-10-03 08:15:39 +00:00
Paul Backus
e1672cfb8d Use a custom exception type in InputRangeObject
This allows users to distinguish between exceptions thrown by
InputRangeObject itself and exceptions thrown by the wrapped range.
2021-10-02 17:27:03 -04:00
lucica28
232ca53126
Fix issue 21507 - added precision for function SysTime.toIsoExtString (#8255)
Fix issue 21507 - added precision for function SysTime.toIsoExtString

Signed-off-by: Petar Kirov <PetarKirov@users.noreply.github.com>
Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-09-30 06:50:28 +00:00
Paul Backus
d15e19fc44 Fix issue 19544 - Can't call inputRangeObject on ranges not supported by moveFront
The range algorithms moveFront, moveBack, and moveAt do not accept all
valid input ranges, bidirectional ranges, and random-access ranges,
respectively. Their inclusion as methods of the InputRange,
BidirectionalRange, and RandomAccessFinite interfaces previously caused
InputRangeObject, which implements those interfaces, to fail to compile
when instantiated with certain valid input, bidirectional, and
random-access ranges.

These methods should not have been included in their respective
interfaces to begin with, but removing them now would break existing
code. Instead, as a workaround, InputRangeObject now implements these
methods by throwing an exception if the wrapped range does not support
them.
2021-09-29 20:35:30 -04:00
Walter Bright
c9b415a817
add -preview=fieldwise to build (#6858)
add -preview=fieldwise to build

Signed-off-by: Nicholas Wilson <thewilsonator@users.noreply.github.com>
Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2021-09-28 16:21:04 +00:00
Hiroki Noda
e9a5297836 Fix Issue 22340 - totalCPUs may not return accurate number of CPUs
bugzilla url: https://issues.dlang.org/show_bug.cgi?id=22340
2021-09-28 12:13:56 +00:00
Razvan Nitu
0225bed3c2
Merge pull request #8252 from DoctorNoobingstoneIPresume/210924_std_typecons_refCounted_UT_01h
refCounted: unittest now also checks object destruction.
2021-09-27 13:03:28 +03:00
DoctorNoobingstoneIPresume
6b05400fba std.container.Array: Payload.reserve re-used, object leak fixed.
This is another attempt to re-use the code in `Payload.reserve` --
similar to https://github.com/dlang/phobos/pull/8143 (commit 0b7bf8dc):
"std.container.Array: Simplify implementation of length (by calling reserve).".

Additionally, `Array`'s variadic constructor is now safer:

  If `emplace`-ing an element fails, successfully `emplace`-d elements are now destroyed.

  Example:

  ```
    auto a = Array!S (S(0), S(1), S(2), S(3));

    // If emplace-ing a[2] (as a copy of S(2)) fails:
    //   - pre-existing behaviour: a[1] and a[0] were not destroyed (bad);
    //   - new behaviour:          a[1] and a[0] are      destroyed (good).
  ```

  A corresponding `unittest` has been added (`S.s_nDestroyed == S.s_nConstructed`):
    When such a failure (`Exception`) is caught, there should be no leaked objects.

  Implementation:
    Previously:
      - the `Payload` `length` used to be increased only once,
        after having successfully `emplace`-d all elements,
        thus incorrectly tracking the number of `emplace`-d elements during the loop
        (but correctly tracking it after the loop -- iff the entire loop succeeded).
    Now:
      - the `Payload` `length` is incremented multiple times,
        at each step i.e. after having successfully `emplace`-d each element,
        thus correctly tracking the number of `emplace`-d elements during the loop.
    Note:
      When the constructor fails, the corresponding destructor is not run.
      But the destructors for successfully constructed sub-objects are run;
      in this case, the destructor for the `_data` sub-object is run --
      and it is this destructor which destroys the successfully emplaced elements
      (iff they have been correctly tracked).
2021-09-27 02:23:14 +03:00
DoctorNoobingstoneIPresume
eb66705762 refCounted: unittest now also checks object destruction..
One of the `unittest`'s has been modified to also check that
a `File` object managed via `RefCounted!File` handles is deleted
when its last handle is destroyed;
2021-09-27 02:19:34 +03:00
Tobias Pankrath
30aabd8b9c Mentions type in error message for missing opPostMove 2021-09-26 12:54:34 +00:00
Razvan Nitu
c59a711bf1
Merge pull request #8253 from nordlow/better-searchPathFor
Improve searchPathFor
2021-09-26 11:14:37 +03:00