Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

Change Log: 2.091.0

previous version: 2.090.0

Download D nightlies
To be released


This changelog has been automatically generated from all commits in master since the last release.

  • The full-text messages are assembled from the changelog/ directories of the respective repositories: dmd, druntime, phobos, tools, dlang.org, installer, and dub.
  • See the DLang-Bot documentation for details on referencing Bugzilla. The DAutoTest PR preview doesn't include the Bugzilla changelog.
  • The pending changelog can be generated locally by setting up dlang.org and running the pending_changelog target:
    make -f posix.mak pending_changelog


2.091.0 comes with 13 major changes and 82 fixed Bugzilla issues. A huge thanks goes to the 56 contributors who made 2.091.0 possible.

List of all upcoming bug fixes and enhancements in D 2.091.0.

Compiler changes

  1. Can now extract delegate from lazy parameter

    The underlying delegate of the lazy parameter may be extracted using the & operator:

    void test(lazy int dg)
    {
        int delegate() dg_ = &dg;
        assert(dg_() == 7);
        assert(dg == dg_());
    }
    
    void main()
    {
        int a = 7;
        test(a);
    }
    

    Previously this caused a compile error.

Runtime changes

  1. core.memory.GC.inFinalizer was added

    A new function exposing information about the state of the GC was added. It returns true if the current thread is executing destructors (finalizers) of objects allocated on the GC heap that are either:

    • no longer being referenced
    • to whose finalizers an explicit call to GC.runFinalizers was made (usually as part of shared library unloading).

    Destructors of objects allocated on the GC heap presently have several limitations or oddities:

    • As destructors of all unreachable objects are ran in indeterministic order, there's no guarantee that object members are alive during the object's finalization
    • Allocation during finalization is disallowed
    • In contrast to stack allocated objects, partially constructed objects (object whose constructor threw an exception) may be finalized

    core.memory.GC.inFinalizer can be used to efficiently guard against programming errors such as the above, or to detect whether certain objects were left to be destroyed by the GC.

  2. Platform dependent execinfo introspection added

    A new module (core.internal.execinfo) has been added for platform dependent execinfo detection. On every POSIX system which provides an execinfo implementation as part of its C runtime the appropriate implementation- dependent execinfo module will be imported automatically.

    Besides that, there is an opportunity for using external execinfo implementations built as separated libraries and linking DRuntime with them.

    IMPORTANT: On platforms with C runtime not providing execinfo functionality one should decide whether an external lib (e.g. libexecinfo) will be used, or not. If not, DRuntime should be built normally without any additional version ID, but with external lib exactly one of the following version IDs should be chosen at compile time. That means, the selected external format cannot be changed later without rebuilding DRuntime.

    It could be really important to keep this in mind when someone is packaging DRuntime for such OSs (e.g. ones using musl libc) and provide packages with and without execinfo support (with the specific external library as dependency) or in the case of source based packages, make this build option selectable (e.g. portage).

    Version IDBacktrace format
    ExtExecinfo_BSDFmt0x00000000 <_D6module4funcAFZv+0x78> at module
    ExtExecinfo_DarwinFmt1 module 0x00000000 D6module4funcAFZv + 0
    ExtExecinfo_GNUFmtmodule(_D6module4funcAFZv) [0x00000000] or module(_D6module4funcAFZv+0x78) [0x00000000] or module(_D6module4funcAFZv-0x78) [0x00000000]
    ExtExecinfo_SolarisFmtobject'symbol+offset [pc]

    These formats above cover most of the "classic" backtrace outputs but as a new important format emerges, it can be easily added.

  3. Added intrinsic toPrec to round to a specific float precision

    The intrinsic core.math.toPrec forces rounding of it floating point argument to the precision of float, double, or real.

    Some floating point algorithms, such as Kahan-Babuska-Neumaier Summation, require rounding to specific precisions. Rounding to precision after every operation, however, loses overall precision in the general case and is a runtime performance problem.

    Adding these functions guarantee the rounding at required points in the code, and document where in the algorithm the requirement exists.

  4. Unittest default mode

    Switched the default for unittests to only run the tests by default. Use --DRT-testmode=run-main for the original behavior (run unittests then main).

    The feature to control unit testing was added in 2.078.0, and the switch above will work for all versions since then.

Library changes

  1. Deprecated std.array.Appender.toString was removed

    The overload accepting a callable was deprecated since 2.079 and has now been removed. Use the overload accepting an output range instead.

  2. Deprecated std.functional.binaryReverseArgs was removed

    This specialisation of reverseArgs accepting exactly two arguments was deprecated since 2.079 and has now been removed. Use reverseArgs instead.

  3. Deprecated std.bitmanip.BitArray.toString was removed

    The overload accepting a callable was deprecated since 2.079 and has now been removed. Use the overload accepting an output range instead.

  4. Deprecated module std.experimental.all was removed

    All symbols contained in Phobos can now be used with import std

  5. Added get!(T) getter to std.json

    This getter will try to return underlying json type as T if possible. It is convenient for automatic integer conversion like this:

    import std.json;
    string s = `{ "a": 123 }`;
    auto json = parseJSON(s);
    
    // This will throw with json["a"].floating
    assert(json["a"].get!double == 123.0);
    

Dub changes

  1. Builds dynamicLibrary targets as dynamic libraries instead of static libraries.

    Dub will no longer build dynamicLibrary targetType's as staticLibrary.

    Except for x86_omf. This has been disabled due to numerous issues that will lead this to not doing what is expected of it.

    No compiler or linker flags have been added at this time, you will need to specify the relevant flag to get the compiler to link dynamically against Phobos.

  2. The $DUB_BUILD_PATH variable was added

    The $DUB_BUILD_PATH variable is now defined inside the postBuildCommands section. It contains the absolute path in which the package was built, and can be used to copy by-products of the build process to their intended locations.

    For example, if an executable exports symbols, you will want to make the resulting import library and symbols export file available somewhere. That can be done with a dub.json section like this:

        "postBuildCommands-windows": [
            "copy /y $DUB_BUILD_PATH\\$DUB_TARGET_NAME.lib $PACKAGE_DIR\\lib"
            "copy /y $DUB_BUILD_PATH\\$DUB_TARGET_NAME.exp $PACKAGE_DIR\\lib"
        ],
    
  3. Command environment variable substitution changed

    Now users can use the documented predefined variables inside custom command directives without the need for a wrapper shell script.

    Before this would have failed:

    "preBuildCommands": ["$DC -run foo.d"]
    
    unless DC was defined as environment variable outside DUB.

    It was before possible to run a script that used the $DC environment variable or on POSIX escape the $ with $$DC to make the shell substitute the variable. These workarounds are no longer needed now.

    API change: none of the different command directives are no longer substituted with the process environment variables. You now access the raw commands as provided by the user in the recipe. dub describe has been adjusted and now also processes the predefined environment variables as well as the process environment variables.


List of all bug fixes and enhancements in D 2.091.0:

DMD Compiler regressions

  1. Bugzilla 10100: Identifiers with double underscores and allMembers
  2. Bugzilla 15812: static struct inside extern(C++) class cannot be used as key to associative array
  3. Bugzilla 16709: [Reg 2.068] Error: common.to at common.d conflicts with common.to at common.d
  4. Bugzilla 17098: Takes hours to -O compile then fails with Internal error: backend/cgreg.c 405
  5. Bugzilla 17145: [REG2.066.0] Tuple expansion error in local enum declaration
  6. Bugzilla 20391: [REG 2.089] DMD compile times increased by 40% because ENABLE_RELEASE=0 in build
  7. Bugzilla 20488: AA.length in multiple modules causes opDispatch failure
  8. Bugzilla 20518: simple import ICE regression

DMD Compiler bugs

  1. Bugzilla 9937: CTFE floats don't overflow correctly
  2. Bugzilla 11847: sub-pkg not available as qualified name
  3. Bugzilla 17257: Wrong recursive template destructor reflection
  4. Bugzilla 18147: Debug information limited in size
  5. Bugzilla 19479: Garbage .init in string mixins in static foreach in mixin templates
  6. Bugzilla 19504: pragma(mangle) ignored for C++ destructors
  7. Bugzilla 19515: POSIX,C++: Template argument pack wrongly mangled
  8. Bugzilla 19542: Forward reference segfault with string namespace C++ syntax
  9. Bugzilla 20362: dmd fails to infer scope parameter for delegate
  10. Bugzilla 20375: std.typecons.RefCounted does not work with checkaction-context
  11. Bugzilla 20421: Exceptions don't work when linking through lld-link
  12. Bugzilla 20474: Deprecation warnings inside deprecated function template
  13. Bugzilla 20507: Debug statements affect inference of templated functions attributes
  14. Bugzilla 20514: obj-c info incorrectly placed in __objc_const section
  15. Bugzilla 20530: is(<...> == module/package) does not work with string mixins
  16. Bugzilla 20537: traits isPackage/isModule and is(package/module) fail on single level package.d import
  17. Bugzilla 20538: malformed enum definition compiles
  18. Bugzilla 20545: Segfault/Assertion failure when parsing invalid AA literal
  19. Bugzilla 20547: Wrong error message when trying to "new" an associative array
  20. Bugzilla 20549: Initialization with a tuple of a module symbol referencing itself could crash dmd
  21. Bugzilla 20551: In @safe code and using delegates, it's possible to escape references to function frame
  22. Bugzilla 20559: Reference type + alias this + AA + AA.clear causes SEGV
  23. Bugzilla 20592: [GCC ASM] [ICE] dmd/iasmgcc.d(332): Assertion failure
  24. Bugzilla 20613: String switch in -betterC fails for 7+ labels

DMD Compiler enhancements

  1. Bugzilla 18665: Deprecate Undocumented Operator Overloads
  2. Bugzilla 20569: [DIP1000] allow taking the address of a scope struct field if it has no indirections

Phobos regressions

  1. Bugzilla 7006: std.math.pow (integral, integral) crashes on negative exponents
  2. Bugzilla 19738: std.range.choose assignment breaks @safe-ty
  3. Bugzilla 20511: Can't format JSONValue to OutputRange due to @safe

Phobos bugs

  1. Bugzilla 5232: [patch] std.conv.to & std.conv.roundTo report invalid overflows for very large numbers
  2. Bugzilla 5628: std.math unittest disabled - roundoff error in pow() on SSE2
  3. Bugzilla 7446: [TDPL] Trivial asynchronous file copy example crashes with OwnerTerminated
  4. Bugzilla 8388: std.traits.MemberFunctionsTuple doesn't work with constructors or destructors
  5. Bugzilla 12461: Typedef and opOpAssign
  6. Bugzilla 15891: Compiler error when std.algorithm.cache after 2 layers of std.algorithm.map
  7. Bugzilla 17427: std.concurrency internal errors on uninitialised mailbox
  8. Bugzilla 17441: std.traits.moduleName gives wrong answer for modules imported under a different name in a mixin
  9. Bugzilla 20232: WhiteHole is unusable with @safe interface functions
  10. Bugzilla 20259: [Function Socket.bind] Doesn't inform what Exception it throws
  11. Bugzilla 20493: Incorrect result of BigInt * BigInt
  12. Bugzilla 20495: std.range.choose range is not safe when calling save
  13. Bugzilla 20521: Checking for and getting empty variables on Wine / XP fails
  14. Bugzilla 20527: std.json CTFE cannot read integer
  15. Bugzilla 20540: (White|Black)Hole does not work with return|scope functions
  16. Bugzilla 20542: std.math.nextafter(NaN, y) and nextafter(x, NaN) should return NaN
  17. Bugzilla 20544: socket.remoteAddress throws out of memory error with unix domain socket peer
  18. Bugzilla 20585: std.stdio.File open() failure leaves File in invalid state
  19. Bugzilla 20639: Some BitArray methods should be const/pure/nothrow/...

Phobos enhancements

  1. Bugzilla 20146: Allow casting from std.bigint.BigInt to built-in floating point types
  2. Bugzilla 20480: make std.getopt ready for DIP 1000
  3. Bugzilla 20548: Use bit vector instead of bool[] in RandomCover when choices cannot be packed in a single word
  4. Bugzilla 20566: std.sformat should avoid allocating memory when printing floating point values

Druntime regressions

  1. Bugzilla 19322: A lot of memory is consumed and not freed to the system when Exception is formatted with stacktrace in debug
  2. Bugzilla 19902: hasElaborateCopyConstructor doesn't know about copy constructors
  3. Bugzilla 20447: [REG 2.089] importing core.thread exposes unistd, hiding object.dup

Druntime bugs

  1. Bugzilla 15322: version(Unicode) should affect only default aliases
  2. Bugzilla 16658: Win32API: default IE ver. set to 4.0 is too old
  3. Bugzilla 19489: Null function call results in no stack trace
  4. Bugzilla 19909: core.stdc.errno missing POSIX error code on Windows
  5. Bugzilla 20459: Runtime arg parsing should stop at '--'
  6. Bugzilla 20468: emplace doesn't forward constructor arguments' (l/r)valueness
  7. Bugzilla 20476: chainTogether leaks exception with -dip1008
  8. Bugzilla 20497: thread with limited stackspace crashes depending on size of TLS
  9. Bugzilla 20512: Return type of memchr should be inout(void)* rather than void*
  10. Bugzilla 20513: Return type of wmemchr should be inout(wchar_t)* rather than wchar_t*
  11. Bugzilla 20591: ldc doesn't print files' directories when printing stack trace
  12. Bugzilla 20629: atomicStore does not compile for struct using -m64

Druntime enhancements

  1. Bugzilla 19218: object.destroy should check for classes for static arrays
  2. Bugzilla 20550: Use fixed seeds for treaps in GC
  3. Bugzilla 20567: GC should not start threads for parallel marking in simple programs
  4. Bugzilla 20577: Add missing symbols related to Windows UAC

dlang.org bugs

  1. Bugzilla 19325: The 'body' keyword is still not deprecated
  2. Bugzilla 20500: running examples on the home page only displays '1 unittests passed'

Installer enhancements

  1. Bugzilla 20489: Installer deleting files after install

Contributors to this release (56)

A huge thanks goes to all the awesome people who made this release possible.

previous version: 2.090.0