Change Log: 2.097.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
Compiler changes
- D ABI change on x86_64 Posix targets
- Added __c_complex_float, __c_complex_double, and __c_complex_real types
- Having both a copy constructor and a generated postblit is now deprecated
- DMD's JSON output will now always include the protection level
- DMD's JSON output now have distinct types for [shared] module constructor/destructor
- Deprecate local templates that receive local symbols by alias
- Improvements for the C++ header generation
- Add -gdwarf=<version> switch for the DMD compiler.
- Introduced __traits(getVisibility, Sym) as an alias to getProtection
- Plain synchronized statements now use run-time allocated mutexes.
- Allow shortened function implementations for single-expresssion functions.
Runtime changes
Library changes
Dub changes
List of all upcoming bug fixes and enhancements in D 2.097.0.
Compiler changes
- D ABI change on x86_64 Posix targets
The compiler has been updated to return the real part of creal numbers in ST0, and the imaginary part in ST1, to match the x86_64 System V ABI.
This is an ABI breaking change and requires recompiling libraries that make use of the creal type.
- Added __c_complex_float, __c_complex_double, and __c_complex_real types
This allows code interfacing with C and C++ to maintain ABI compatibility with _Complex types. It replaces the built-in types cfloat, cdouble, and creal which are due to be deprecated.
- Having both a copy constructor and a generated postblit is now deprecated
Up until this release, the postblit had priority over the copy constructor, no matter if the former was user-defined or generated. This prevented new code that uses the copy constructor to interact with library code that uses the postblit. To enable this interaction, having a generated postblit and a copy constructor (user-defined or generated) is now deprecated. For example:
// library code using postblit struct A { this(this) {} } // new code using copy constructor struct B { A a; this(const scope ref B) {} }
Up until this release, in the above code, struct B had a generated postblit that had priority over the user defined copy constructor. With this release, a deprecation will be issued at the definition of structB, stating that the postblit is going to be preferred to the copy constructor. If B has both a user-defined postblit and a copy constructor (generated or user-defined), the postblit will continue to have priority.
To get rid of the deprecation, the user can either:
- Explicitly @disable this(this) in struct B. That will instruct
- Define a postblit for struct B. That will instruct the compiler
- Remove all copy constructors from struct B. In this case the postblit
- DMD's JSON output will now always include the protection level
In previous release, the JSON output the compiler generates did not include the protection level if it was public. It is now always included.
- DMD's JSON output now have distinct types for [shared] module constructor/destructor
Previously, module constructors and destructors (shared or not) would be output as functions, and the only way for documentation generators to recognize them was to search for the pattern that was used for their naming. This means that external tools would need to depend on internal compiler details for generating documentation. From this release, 4 new values have been introduced for kind: shared static constructor, shared static destructor, static constructor, static destructor.
- Deprecate local templates that receive local symbols by alias
Support for instantiating local and member templates with local symbols was implemented in DMD 2.087.0. However, the implementation was incompatible with GDC and LDC backends.
In order to maintain feature parity among D implementations, this improvement has been deprecated, and may be removed from a future DMD release.
- Improvements for the C++ header generation
The following features/bugfixes/improvements were implemented for the experimental C++ header generator:
- Generate fieldwise constructors for aggregates
- Don't emit instantiated classes as unique class declarations
- Emit template arguments for instantiated base classes
- Don't emit enums for opaque types specially handled by the compiler
Note: The header generator is still considerer experimental, so please submit any bugs encountered to the bug tracker.
- Add -gdwarf=<version> switch for the DMD compiler.
Emit DWARF symbolic debug info (non-Windows machines only). Supported versions are 3, 4, and 5.
Once added, the -g switch is implicitly activated.
Note: DWARF Version 5 is experimental.
- Introduced __traits(getVisibility, Sym) as an alias to getProtection
Since the changes in v2.071.0, attributes such as private, protected, public, etc... are visibility attributes, and not protection attributes. However, the name of this trait predates such change and was thus inconsistent with all the other documentation. This change only introduce the new name, and getProtection has been left un-deprecated, and while using the new name is reccommended for users that only supports the latest version of the language, there is no plan to deprecate it.
- Plain synchronized statements now use run-time allocated mutexes.
Synchronized statements have two forms, synchronized and synchronized(exp). When there is no expression argument, a global mutex is created using a static buffer big enough to store the platform dependant critical section type and a pointer field.
Example:
void main() { synchronized { // __gshared byte[40 + 8] __critsec; // _d_criticalenter(&__critsec[0]); // scope(exit) _d_criticalexit(&__critsec[0]); (cast() counter) += 1; } }
This implementation suffers from a couple deficiencies. Neither the size nor alignment of the critsec buffer are obtained from the OS critical section type defined in druntime. As a result, if the size allocated by the compiler is too small, or the platform has strict alignment requirements, then the program run-time will crash on entering the synchronized statement.
This code will now call a new implementation that allocates the critical section lazily at run-time, moving all logic out of the compiler to druntime.
- Allow shortened function implementations for single-expresssion functions.
-preview=shortenedMethods is added. This allows functions to be written in a similar form to lambda functions:
// these 2 are equivalent int foo() { return 1; } int foo() => 1;
The syntax allows the form => expr to replace the function body { return expr; }
Runtime changes
- The druntime option callStructDtorsDuringGC has been removed
It had been deprecated in 2.088.
- FreeBSD declarations from statvfs that belong in mount have been removed
It had been deprecated in 2.082 in favor of core.sys.freebsd.sys.mount.
- Experimental llvm-libunwind based backtrace printing was added
Currently, druntime uses the backtrace and backtrace_symbols functions to provide debug informations (addresses and function names, respectively).
This can create issues for target that do not provide backtrace, such as Musl libc. Additionally, the backtrace interface is inherently limited, as it only allow to get up to X frames (where X is the size of the buffer), and forces them to be stored continuously in memory. The same apply to backtrace_symbols.
On the other hand, libunwind is an industry standard for unwinding and stack trace inspection. It has been ported to a variety of platform, has a simple yet flexible API, and is part of GCC, and a similar library is part of LLVM.
Starting from this release, druntime includes a way to use LLVM's libunwind as a backtrace provider. The support is limited to LLVM's version of libunwind, as it is available on Alpine Linux, and easier to interface with.
For packagers, one can define DRuntime_Use_Libunwind when building druntime, enabling the support by default.
Library changes
- Deprecate std.math : approxEqual
The template approxEqual for comparing floating point numbers has been deprecated.
Please use the template isClose instead, which has better default values and is symmetric in its arguments.
To (almost) keep the current behaviour of approxEqual(a, b) use isClose(a, b, 1e-2, 1e-2), but we recommend to adjust the code to make it work with isClose(a, b).
Dub changes
- 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.
- 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" ],
- 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.097.0:
DMD Compiler regression fixes
- Bugzilla 21229: [REG 2.080.2] Constructor flow analysis doesn't understand unions
- Bugzilla 21687: Confusing error message for CTFE pointer in static initializer
- Bugzilla 21752: Template constraint breaks nested eponymeous template
- Bugzilla 21798: checkaction=context creates temporary of type void
- Bugzilla 21802: opAssign and opOpAssign treat lazy void parameters inconsistently
- Bugzilla 21806: Overload selection ignores slice
- Bugzilla 21880: [REG 2.095] scope variable assigned to non-scope parameter calling function
- Bugzilla 21898: Qualifier ignored in alias definition if parentheses are not present
- Bugzilla 21914: naked assembler functions get wrong offset to parameters
- Bugzilla 21936: [REG 2.080.1] Segfault when compiled with -dip1000
DMD Compiler bug fixes
- Bugzilla 2450: Error using operators from named template mixin
- Bugzilla 13815: Inconsistent goto jump behavior between compile-time and runtime
- Bugzilla 14114: Allow volatileLoad/Store to access null location
- Bugzilla 14740: __traits(allMembers) returns erroneous 'this' member for types declared in functions.
- Bugzilla 14954: extern opaque struct instance doesn't compile
- Bugzilla 15478: cases of missed CTFE evaluation when defining arrays dimensions
- Bugzilla 16472: Spurious "is used as a type" when aliasing enum template as default parameter
- Bugzilla 17146: Internal error: tk.c 266 with -O -inline
- Bugzilla 18251: deprecate + transition=complex shouldn't look at functions with non-matching if constraints
- Bugzilla 19192: [wrong-code] [crashes] Covariant method interface <- abstract class <- class hierarchies
- Bugzilla 19387: [dip1000] __fieldPostblit should be scope or deduce scope qualifier
- Bugzilla 19443: core.simd generates MOVLPS instead of MOVHLPS
- Bugzilla 19783: Fail to emplace struct with betterC
- Bugzilla 20460: [OSX] DMD writes the same address everywhere in DWARF debug infos
- Bugzilla 20581: DIP1000 wrongly flags hidden ref temporary
- Bugzilla 20599: cpp_long as enum type doesn't work
- Bugzilla 20704: -preview=rvaluerefparam does not work with init as default parameter
- Bugzilla 20705: -preview=rvaluerefparam does not work with template deduction
- Bugzilla 20855: stack overflow when compiling large file
- Bugzilla 21403: dmd/backend/cgcs.d:375 assert failed
- Bugzilla 21651: Unimported package doesn't error out when used as part of fully qualified type
- Bugzilla 21661: Can't use fully-qualified name of the current module inside an expression
- Bugzilla 21665: Void initialization should not be allowed for instances of struct with invariant
- Bugzilla 21668: Cannot declare ref parameter of opaque type
- Bugzilla 21672: [REG][ICE][SIMD] accessing SIMD type as a short causes compiler ice
- Bugzilla 21680: inconsistent error on typeof({ return field; }())
- Bugzilla 21684: Assert fail for Win32 with a struct larger than 64k in size
- Bugzilla 21699: Duplicate error for index out of bounds at compile time
- Bugzilla 21726: Wrong comparison in package(...) visibilities
- Bugzilla 21739: debug case can access variable from other case
- Bugzilla 21742: dot template expressions don't have the void type like any template
- Bugzilla 21743: getOverloads fails to propagate 'this' expression for template member
- Bugzilla 21753: Struct literal with function literal member not allowed as template value argument
- Bugzilla 21765: Assignment-as-condition error with checkaction=context
- Bugzilla 21779: assert not omitted for -release -checkaction=context
- Bugzilla 21785: Cannot declare variable of opaque enum with base type
- Bugzilla 21791: Stack overflow for forward-referenced enum initializer
- Bugzilla 21792: Enum using itself as base type crashes dmd
- Bugzilla 21793: Cannot initialize shared member with -preview=nosharedaccess
- Bugzilla 21797: Stack overflow for forward-referenced enum min / max
- Bugzilla 21799: CTFE doesn't call base class destructor for extern(D) classes
- Bugzilla 21812: __traits(allMembers) on types with value tuples return ghost members
- Bugzilla 21816: testing XMM for nan does not work
- Bugzilla 21822: Optimizer flowlv() does not account for OPmemcmp and OPstrcmp
- Bugzilla 21825: DIP1034: Do not spuriously warn "calling XXX without side effects discards return value of type 'noreturn'"
- Bugzilla 21826: MSCOFF output for Win32 should not use EBP for anything other than the frame pointer
- Bugzilla 21827: Null pointer exception in elToPair() in backend/cgelem.d
- Bugzilla 21828: Enum forward-references just assume int base type
- Bugzilla 21830: Wrong deprecation message when non-deprecated template in static condition
- Bugzilla 21831: Wrong deprecation message in template parameters before evaluating constraints
- Bugzilla 21832: Wrong deprecation message when importing non-deprecated template in static condition
- Bugzilla 21833: Optimizer incorrectly rewrites integer comparison to unsigned short comparison
- Bugzilla 21849: UTF8: -verrors=context doesn't respect multibyte characters
- Bugzilla 21861: ctfe fails when a nested enum or function has a UDA
- Bugzilla 21870: Property/method not invoked and requires () when used in static array length
- Bugzilla 21874: The test suite fails with most recent GDB versions
- Bugzilla 21876: Zero-length static arrays "cannot be read at compile time"
- Bugzilla 21878: "ref" lost when indexing array in CTFE
- Bugzilla 21882: [ICE][dip1021] src/dmd/escape.d(1850): Assertion failure
- Bugzilla 21883: poor error message when swapping order of base class and interface
- Bugzilla 21918: segfault in getParameterStorageClasses on auto function with error
- Bugzilla 21927: ICE (illegal instruction) with static foreach over empty member template
- Bugzilla 21940: Compiler flags -check=on/off not recognized
DMD Compiler enhancements
- Bugzilla 16140: while(auto x = y) does not behave like if(auto x = y)
- Bugzilla 20068: Union initialization in constructors should be @safe
- Bugzilla 21203: Accept pragma(mangle) on aggregate types
- Bugzilla 21585: add __traits(totype, string) to convert mangled type string to an existing type
- Bugzilla 21630: assert(0) and assert(false) should not be marked for coverage
- Bugzilla 21835: Operation on float should use XMM register, not x87
- Bugzilla 21845: Wrong ParameterStorageClass when -preview=in is used
Phobos regression fixes
- Bugzilla 20886: std.process.browse does not work with URLs 256 characters or longer
- Bugzilla 21716: std.regex performance regression (additional GC allocation)
- Bugzilla 21725: Specifying null as bitfields variable name now fails
Phobos bug fixes
- Bugzilla 8424: Compile time conversions of double/floats to strings
- Bugzilla 9297: Formatting of floating point values in std.format truncates reals to double
- Bugzilla 15227: std.format undocumented grammar
- Bugzilla 15348: std.stdio.writef format specifier error message
- Bugzilla 15386: std.format.formatValue usage hangs
- Bugzilla 15888: std.format should not produce deprecated hexstrings
- Bugzilla 16432: JSON incorrectly parses to string
- Bugzilla 17381: Checked format string is permissive after floating point argument
- Bugzilla 18780: Inconsistent behavior with Variant holding int converting to unsigned types
- Bugzilla 20320: format("%f") leeds to wrong output
- Bugzilla 20371: std.format limited to 500 characters for floats
- Bugzilla 20502: Converting std.typecons.RefCounted!T to a string gives T's storage location instead of T's fields when T is a struct without an explicit toString
- Bugzilla 20534: std.format: %r on boolean gives wrong result
- Bugzilla 20536: std.format: %a on reals is inconsistent with %a on float/double
- Bugzilla 21456: std.format does not accept enum member with string base type as template parameter
- Bugzilla 21512: RedBlackTree!Tid treats any values as duplicated except for Tid.init
- Bugzilla 21575: Child processes spawned by std.process.spawnProcess accidentally inherit signal masks in parent process
- Bugzilla 21592: two stack traces if high surrogate is printed
- Bugzilla 21601: std.math : pow(float/double, -2) produces sometimes wrong result
- Bugzilla 21627: macOS: std.stdio.File.sync does not guarantee to be written to disk
- Bugzilla 21641: std.format: %g produces in rare circumstances inconsistent result
- Bugzilla 21679: Assertion failure in Base64.encoder for empty input range of ranges
- Bugzilla 21700: Long deprecated Stopwatch std.datetime is still not removed
- Bugzilla 21702: avoid quadratic template expansion in constraints of multiple search term versions of std.algorithm.searching.startsWith & endsWith
- Bugzilla 21704: Nullable fails to destroy static array elements
- Bugzilla 21705: Nullable!T.opEquals fails for T with non-const opEquals overload
- Bugzilla 21707: std.base64: Faulty input creates range error instead of Base64Exception
- Bugzilla 21708: SumType.opEquals gives confusing error message
- Bugzilla 21721: casting std.BigInts to built-in floating point types doesn't work without -preview=dip1000
- Bugzilla 21722: toString(sink, string format) does not work with non-"%s" strings
- Bugzilla 21724: std.algorithm.mutation.copy fails on overlapping arrays if the source array's pointer is less than the destination array's pointer
- Bugzilla 21728: rawRead calls fread with NULL if invoked on closed readEnd of Pipe (segfault)
- Bugzilla 21729: rawRead derefences null pointer if invoked on closed File (segfault)
- Bugzilla 21730: null ptr dereferenced in ChunksImpl.opApply (SIGSEGV)
- Bugzilla 21738: std.format.spec: singleSpec should throw on "%%"
- Bugzilla 21758: std.experimental.checkedint opBinaryRight with integer left-hand side does not compile for any operators except + and -
- Bugzilla 21777: std.format: several issues when formatting integers with precision
- Bugzilla 21801: std.typecons.ReplaceType does not work for in parameters
- Bugzilla 21814: std.format: grouping with width 0 causes floating point exception
- Bugzilla 21817: std.format: %u on integer does not print unsigned value
- Bugzilla 21820: std.format: formatting zero should never lead to empty string
- Bugzilla 21834: std.numeric.gcd can't handle negative values
- Bugzilla 21836: std.format: grouping may cause RangeError
- Bugzilla 21838: std.format: Grouping garbles up %a output
- Bugzilla 21840: std.format: grouping ignores space flag with %e
- Bugzilla 21841: std.format: grouping produces strange result with zero precision and %e
- Bugzilla 21842: std.format: "%-+05,g" adds extra comma
- Bugzilla 21846: std.format: provided format string for toString does not work with grouping
- Bugzilla 21853: std.format: formatting real.max in CTFE fails
- Bugzilla 21863: FieldNameTuple returns emptry string for interfaces
- Bugzilla 21875: std.format: wrong number of format specifiers in nested format string of associative arrays should be detected
- Bugzilla 21900: std.format: round to even does not work for hex integers with letters
Phobos enhancements
- Bugzilla 13595: Extend std.algorithm.groupBy to support non-equivalence relations
- Bugzilla 16200: Faster pow implementation for integral exponents
- Bugzilla 18024: checkedint.Abort and checkedint.Warn should be @safe
- Bugzilla 18627: std.complex is a lot slower than builtin complex types at number crunching
- Bugzilla 20756: ImplicitConversionTargets ignores interface inheritance
- Bugzilla 21759: std.experimental.checkedint.Checked is not compatible with "%d" and "%x" integer format specifiers
- Bugzilla 21760: std.conv.to does not know how to convert a string to a std.experimental.checkedint.Checked!T
- Bugzilla 21761: make std.experimental.checkedint.Checked!T.toHash callable when Checked!T is shared
- Bugzilla 21808: std.format: It should be possible to change the order of key and value of AAs.
- Bugzilla 21847: std.format: %e, %g and %a should be supported for integers too
- Bugzilla 21858: std.format: centering output
Druntime regression fixes
- Bugzilla 21097: [REG2.083] Stack exhaustion upon large struct .destroy
- Bugzilla 21363: [REG2.094] Implementation of core.bitop.ror(x,0) is using UB
- Bugzilla 21709: std.conv.emplace not usable in betterC - 2.096
- Bugzilla 21712: [REG 2.096.0] sometimes coverage *.lst files are corrupted
Druntime bug fixes
- Bugzilla 21371: core.stdcpp.allocator: _Adjust_manually_vector_aligned checks for sentinel unconditionally (Windows only)
- Bugzilla 21701: casWeak is not implemented
- Bugzilla 21764: checkaction=context doesn't work for empty tuples
- Bugzilla 21857: TypeInfo_Array.compare can give wrong result when either array exceeds 2GB
Druntime enhancements
- Bugzilla 21784: joining a detached thread results in segfault.
- Bugzilla 21789: Codecov should use default umask for file permissions
dlang.org enhancements
- Bugzilla 21161: [Variadic Templates] uses outdated example from D1 / Tango
- Bugzilla 21869: Invalid hyperlink to doxygen
Contributors to this release (57)
A huge thanks goes to all the awesome people who made this release possible.
- Adam D. Ruppe
- aG0aep6G
- Airbus5717
- Andrei Alexandrescu
- Andrej Petrović
- Arne
- Ate Eskola
- Atila Neves
- Basile Burg
- berni44
- Boris Carvajal
- Brian Callahan
- Chigusa0w0
- dkorpel
- DoctorNoobingstoneIPresume
- Florian
- Hiroki Noda
- Iain Buclaw
- Imperatorn
- Jason B. Cox
- Johan Engelen
- Jon Degenhardt
- linkrope
- Lucien Perregaux
- Luhrel
- Luís Ferreira
- Martin Kinkelin
- Martin Nowak
- Mathias Lang
- Mathis Beer
- Max Haughton
- MetaLang
- mhh
- Mike Parker
- MoonlightSentinel
- Nathan Sashihara
- Nicholas Wilson
- Nick Treleaven
- nordlow
- Paul Backus
- Per Nordlöw
- Puneet Goel
- Razvan Nitu
- Robert Aron
- Robert Schadek
- Roy Margalit
- Sebastian Wilzbach
- Stefan Koch
- Tobias Pankrath
- Tomoya Tanjo
- Vladimir Panteleev
- Walter Bright
- Witold Baryluk
- wolframw
- Ömer Faruk Irmak
- Ömer Faruk IRMAK
- Ömer Faruk Irmak