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.094.0

previous version: 2.093.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.094.0 comes with 10 major changes and 50 fixed Bugzilla issues. A huge thanks goes to the 41 contributors who made 2.094.0 possible.

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

Compiler changes

  1. Add __traits(child, parent, member)

    Takes two arguments. The first must be a symbol or expression and the second must be a symbol, such as an alias to a member of parent. The result is member interpreted with its this context set to parent. This is the inverse of __traits(parent, member).

    struct A
    {
        int i;
        int foo(int j) {
            return i * j;
        }
    }
    
    alias Ai = A.i;
    
    void main()
    {
        A a;
    
        __traits(child, a, Ai) = 3;
        assert(a.i == 3);
        assert(__traits(child, a, A.foo)(2) == 6);
    }
    
  2. Improve type determination for array literals

    There were some cases where DMD wasn't able to determine the common type for array literal elements. Mismatched enums and literals containing only mutable and immutable elements should now be correctly inferred.

  3. Exception-throwing code can now be used in debug blocks

    When writing debug code, one isn't interested statically ensuring that a function block doesn't throw, but a pleasant debugging experience as e.g. writing to the console or logfiles typically can't be nothrow. DMD already allowed to escape pure and @nogc within debug statement. With this release, exception-throwing code can be called from debug statements too:

    import std.stdio;
    void main() nothrow
    {
        debug writeln("Your throwing log statement.");
    }
    
  4. Always inline pragma(inline, true) functions regardless of -inline compiler switch.

    Marking a function with pragma(inline, true) will now cause it to be always inlined when called, and a compile error will result if it cannot be inlined.

    If the pragma(inline, true) is embedded in the function body rather than outside it, it may not always take effect. (It depends on whether the function body is analyzed before it is called or not.)

    If a function marked with pragma(inline, true) cannot be inlined it will now issue a warning if and only if the -wi command line switch is given. Previously, it would issue an error.

  5. The deprecation period for implicit override has ended

    Implicit overrides of base classes methods were deprecated in 2.075.0 (released 2017-07-19) when issue 17349 was fixed by PR 6731.

    The deprecation period has now ended and the following code will always error from now:

    class Base
    {
        void myFunction();
        void myOtherFunction(void* ptr);
    }
    
    class Child : Base
    {
        // Error: Implicitly overriding `Base.myFunction`
        void myFunction() const;
        // Error: Implicitly overriding `Base.myOtherFunction(void*)`
        void myOtherFunction(const void* ptr);
    }
    
  6. Strict implicit conversion rules for Vector types

    Previously, the compiler allowed any __vector type to be implicitly convertible with any other __vector type.

    int4 x = 2;
    float8 y = x;
    short8 z = y / 3;
    

    In this release, __vector types now, like static arrays, can only be implicitly converted to either qualified types of itself, or void.

    const int4 a = 5;
    int4 b = a;         // OK, both are int4
    void16 c = a;       // OK, cast to void of same size.
    float4 d = b;       // Error, cannot implicitly convert int4 to float4.
    

    Explicit conversions between __vector types can be done, but only between vectors of the same size.

    long2 a = 8;
    short8 b = cast(short8)a;   // OK
    short16 c = cast(short16)b; // Error, cannot cast because of different sizes.
    

    Users of the __simd and __simd_sto intrinsics will have to either add explicit casts from void16 to the appropriate type at each use, or operate strictly with void16 vectors until a value is required to be peeked.

    float4 fun1(float4 a, float4 b)
    {
        a = cast(float4)__simd(XMM.ADDPD, a, b);
        a = cast(float4)__simd(XMM.ADDSS, a, b);
        return a;
    }
    
    float4 fun2(void16 a, void16 b)
    {
        a = __simd(XMM.ADDPD, a, b);
        a = __simd(XMM.ADDSS, a, b);
        return cast(float4)a;
    }
    
  7. Parameters marked as in will now be properly displayed

    In earlier releases, using in on parameters would be lowered too early, leading to confusing display: error messages would show the parameter as const (or scope const if -preview=in was used), and so would header generations or stack traces. The header generation was problematic, as a header generated with -preview=in would be different from one generated without. From this release, in will now display correctly in every message. As this requires an update to the mangling, some older debuggers or tools might not be able to properly demangle functions that uses in parameters.

  8. Usage of vector types and operations on an unsupported -mcpu= will now error

    Previously, the compiler accepted the following code as being supported by all -mcpu= types on both OSX 32-bit and all 64-bit targets.

    __vector(long[4]) x;    // AVX type
    x += 1;                 // AVX2 operation
    

    In this release, all __vector types and operations now check the current CPU being targeted for, and will issue an error if there is insufficient support.

    This also allows for conditional compilation using __traits(compiles) to probe which operations are supported at compile-time.

    static if (__traits(compiles, long4))
    {
        // Compiled in if `-mcpu=avx` or higher
    }
    
    static if (__traits(compiles, { int4 x; x += 1; }))
    {
        // Compiled in if `-mcpu=baseline` or higher
    }
    
    static if (__traits(compiles, { int4 x; x *= 1; }))
    {
        // Compiled in if `-mcpu=avx` or higher
    }
    
    static if (__traits(compiles, { int8 x; x += 1; }))
    {
        // Compiled in if `-mcpu=avx2` or higher
    }
    

    The following tables describe what minimum -mcpu= level is required.

    Minimum Required -mcpu= for 128-bit Vector Types
    void16byte16ubyte16short8ushort8int4uint4long2ulong2float4double2
    baselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline

    Minimum Required -mcpu= for 128-bit Vector Operators
    Operatorbyte16ubyte16short8ushort8int4uint4long2ulong2float4double2
    +baselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    -baselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    *baselinebaselineavxavxbaselinebaseline
    /baselinebaseline
    &baselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    |baselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    ^baselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    +=baselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    -=baselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    *=baselinebaselineavxavxbaselinebaseline
    /=baselinebaseline
    &=baselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    |=baselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    ^=baselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    unary~baselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    unary+baselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    unary-baselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline

    Minimum Required -mcpu= for 256-bit Vector Types
    void32byte32ubyte32short16ushort16int8uint8long4ulong4float8double4
    avxavxavxavxavxavxavxavxavxavxavx

    Minimum Required -mcpu= for 256-bit Vector Operators
    Operatorbyte32ubyte32short16ushort16int8uint8long4ulong4float8double4
    +avx2avx2avx2avx2avx2avx2avx2avx2avxavx
    -avx2avx2avx2avx2avx2avx2avx2avx2avxavx
    *avx2avx2avx2avx2avxavx
    /avxavx
    &avx2avx2avx2avx2avx2avx2avx2avx2
    |avx2avx2avx2avx2avx2avx2avx2avx2
    ^avx2avx2avx2avx2avx2avx2avx2avx2
    +=avx2avx2avx2avx2avx2avx2avx2avx2avxavx
    -=avx2avx2avx2avx2avx2avx2avx2avx2avxavx
    *=avx2avx2avx2avx2avxavx
    /=avxavx
    &=avx2avx2avx2avx2avx2avx2avx2avx2
    |=avx2avx2avx2avx2avx2avx2avx2avx2
    ^=avx2avx2avx2avx2avx2avx2avx2avx2
    unary~avx2avx2avx2avx2avx2avx2avx2avx2
    unary+baselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaselinebaseline
    unary-avx2avx2avx2avx2avx2avx2avx2avx2avxavx

Runtime changes

  1. Equality of arrays of structs is consistent again, as before v2.078

    Since v2.078, some array equality comparisons (e.g., if both arrays are dynamic arrays) have been wrongly using a .tupleof comparison for structs without custom opEquals, basically enforcing -preview=fieldwise for these array comparisons.

    union U
    {
        string s;
    }
    
    void main()
    {
        static immutable from = "from", from2 = "from2";
        U[] a = [{ s : from }];
        U[1] b = [{ s : from2[0..4] }];
        assert(a[0] != b[0]);
        assert(a != b);
        assert(a != b[]); // worked before v2.078, been failing since, now working again
    }
    

Dub changes

  1. Running dub upgrade on a package-less folder is now a no-op

    Prior to this change, accidentally running dub upgrade in a folder where no dub.json / dub.sdl was present would leave you with a dub.selections.json and, in some instances, an empty .dub folder. This has been fixed and running dub upgrade where one shouldn't will now only generate a friendly error message.


List of all bug fixes and enhancements in D 2.094.0:

DMD Compiler regressions

  1. Bugzilla 20958: incomplete semantic analysis when generating code for function
  2. Bugzilla 20981: Runtime segfault for inlined __simd_sto
  3. Bugzilla 21088: std.meta.staticMap no longer works for typeid
  4. Bugzilla 21091: [ICE] Segmentation fault: Module::importAll(Scope*) (this=0x0, prevsc=0x0) at dmd/dmodule.d:1124

DMD Compiler bugs

  1. Bugzilla 6459: Inline assembler does not work well for 64 bit registers R8..R15
  2. Bugzilla 12490: No "Error: , has no effect" Error for comma expression LHS
  3. Bugzilla 14458: very slow ubyte[] assignment (dmd doesn't use memset)
  4. Bugzilla 15103: Improve declaration / initialization syntax error message
  5. Bugzilla 17720: Wrong code using vector extensions with different types
  6. Bugzilla 18748: bt instruction with immediate offset uses 64-bit variant for 32-bit data
  7. Bugzilla 18749: bt instruction using 64-bit register for 32-bit offset
  8. Bugzilla 19210: Poor error message for return function parameter that is not ref
  9. Bugzilla 20363: painting XMM registers as integers leads to codegen bugs
  10. Bugzilla 20422: confusing error "new can only create structs, dynamic arrays or class objects, not int[]'s"
  11. Bugzilla 20761: __traits(isSame) for alias tuples is broken and underspecified
  12. Bugzilla 20831: __traits(getAttributes) failes to compile when used on a parameter with no name
  13. Bugzilla 20911: Documentation for test/unit is non-existant
  14. Bugzilla 20938: Cannot create const arrays mixing immutable and mutable structs with indirections
  15. Bugzilla 20963: wrong code for cast(double)anUlong
  16. Bugzilla 20995: Range violation with -preview=dip1021
  17. Bugzilla 21001: Private alias becomes public if used before declaration
  18. Bugzilla 21019: Azure pipelines Windows_VisualD win32-ldc fails with Heisenbug
  19. Bugzilla 21037: AVX code sometimes fails to set VEX prefix
  20. Bugzilla 21040: SIMD: illegal instruction using 32-byte operations on AVX
  21. Bugzilla 21050: __traits(getOverloads) for templates returns incorrect symbol for the first overload
  22. Bugzilla 21058: __traits(getOverloads) forgets "this" with third argument or if first overload is a template
  23. Bugzilla 21082: Testsuite fails on OSX (runnable/test16096.sh with asserts on)
  24. Bugzilla 21089: With vm.overcommit_memory=0, DMD can't link if it uses more than half the total (ram+swap) memory in the system.
  25. Bugzilla 21092: [ICE] Segmentation fault in ExpressionPrettyPrintVisitor::visit(CommaExp*) at dmd/hdrgen.d:2293
  26. Bugzilla 21117: When compiler segfaults running autotester, cannot tell which file it was testing

DMD Compiler enhancements

  1. Bugzilla 1995: invalid paths feed to -J option should be warned
  2. Bugzilla 12223: __traits(getMember,...) needed for aliases
  3. Bugzilla 14936: Dividing by a power of 2 slow on 32bit
  4. Bugzilla 19277: storage class used in alias statement has no effect
  5. Bugzilla 19663: On x86_64 the fabs intrinsic should use SSE
  6. Bugzilla 19705: Static foreach slow for numeric ranges
  7. Bugzilla 20931: code which was executed at ctfe should be accounted for in coverage
  8. Bugzilla 20990: Optimizer should move cold branches to the end of the function
  9. Bugzilla 21060: ICE in semantic, at d/dmd/dstruct.c:1224

Phobos bugs

  1. Bugzilla 12521: std.getopt does not conform to documentation
  2. Bugzilla 20929: std.experimental.allocator.expandArray's range-based overload fails to instantiate for char and wchar arrays.
  3. Bugzilla 20949: std.range.popFront is unsafe in release mode
  4. Bugzilla 21021: std.variant confused by alias this when struct larger than maxDataSize

Phobos enhancements

  1. Bugzilla 20889: Support construction of std.bigint.BigInt from a sign and a byte-array magnitude
  2. Bugzilla 21113: std.file.thisExePath on NetBSD depends upon the /proc filesystem

Druntime bugs

  1. Bugzilla 20910: Default unittest runner reports wrong unittest count
  2. Bugzilla 21029: Remove __ArrayEq which the compiler no longer uses as of DMD PR #11212
  3. Bugzilla 21055: core.stdc.stdarg is not @nogc
  4. Bugzilla 21116: onArrayCastError is horribly unsafe

Druntime enhancements

  1. Bugzilla 21026: add core.bitop.byteswap(ushort)

Contributors to this release (41)

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

previous version: 2.093.0