Change Log: 2.113.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
- Finally statements are no longer rewritten to a sequence if no Exception was thrown
- New experimental Data Flow Analysis Engine for nullability and truthiness
- Allow some forms of printf calls to be treated as @safe
- The compiler now inlines pragma(inline, true) functions in a separate pass
- Add support for with(auto x = expression())
Library changes
Dub changes
List of all upcoming bug fixes and enhancements in D 2.113.0.
Compiler changes
- Finally statements are no longer rewritten to a sequence if no Exception was thrown
Finally statements have been allowed to rewrite to sequences when no Exception was throwable from within the try body. This has been shown to be problematic as cleanup when an Error is thrown does not occur.
By default this has been reverted back to the pre-2018 behavior of not doing the rewrite.
To change this use the new switch -checkactionfinally=off to reenable the previous behavior.
This behavior can be observed by running the following code:
import core.stdc.stdio; void main() { try { callMe(); } finally { printf("exiting!\n"); } } void callMe() { throw new Error("hi there :)"); }
When the switch is set to on, "exiting!" will be printed.
The -betterC switch is unaffected by this change.
- New experimental Data Flow Analysis Engine for nullability and truthiness
A new experimental Data Flow Analysis (DFA) has been implemented under the preview flag -preview=fastdfa. The intent of the engine is to be both fast and free from false positives, if successful it may in the future be turned on by default.
No attributes have been implemented to date, before they are considered the engine itself must be both usable with the right tradeoffs and have desirable features. This has some side effects, it prevent separate compilation, function pointers, and cyclic functions from being analysable. These limitations are not supposed to prevent a successful compilation when in use.
The engine itself is variable centric with a strong focus on giving up on analysing a variable if things get too complex for it. This can result in messages that may not appear to make sense for where they are emitted, due to the way shortcutting of analysis works. As an example of loops:
void loopy() { int* ptr = new int; foreach (i; 0 .. 2) // Error: Variable `ptr` was required to be non-null and has become null { int val = *ptr; ptr = null; } }
If the engine is successful, the reporting mechanism would be replaced with a tracing state pass. This would offer for a function line by line explanation of how and why the engine thought something was true.
The engine has been tested on a 100k LOC defensively written codebase without any false positives. The performance is similar to DIP1000 and is not supposed to be noticeable.
- Allow some forms of printf calls to be treated as @safe
printf function calls in general are unsafe. Most calls, however, are safe. This change examines the format string to printf and allows format strings that do not include s formats to be allowed in @safe code.
For example:
@safe void func(int i, char* s) { printf("i is %d\n", i); // allowed printf("s is %s\n", s); // unsafe, not allowed }
- The compiler now inlines pragma(inline, true) functions in a separate pass
The compiler now considers pragma(inline, true) functions for inlining in a dedicated pass before trying to inline other eligible functions. This provides better control of inlining decisions, for example:
auto staticSquares(uint n)() { int[n] arr; static foreach(i; 0 .. n) arr[i] = (i + 1) ^^ 2; return arr; } pragma(inline, true) int thirtyThirty() { return staticSquares!30[$ - 1]; }
Previously, dmd -inline would first inline staticSquares() into thirtyThirty() and subsequently fail to inline thirtyThirty() into its callers. With the new implementation, the programmer can expect the compiler to replace calls to thirtyThirty() with staticSquares!30[$ - 1] before making other inlining decisions.
- Add support for with(auto x = expression())
Added support for using with statements with an expression initialiser as an AssignExpression, like if, while for and switch`. For backwards compatibility, with still also accepts a qualified expression without assignment to a variable as in with(immutable expression()).
Runtime changes
- Gravedigger approach to Throwables escaping a thread entry point is now available
A new method is added to ThreadBase enabling filtering of any Throwable's before it is handled by the thread abstraction. This may be used per-thread and globally, to log that an Error has occured or to exit the process.
A reasonable error handler that may be of use is:
import core.exception; void main() { filterThreadThrowableHandler = (ref Throwable t) { import core.stdc.stdio; import core.stdc.stdlib; if (auto e = cast(Error) t) { auto msg = e.message(); fprintf(stderr, "Thread death due to error: %.*s\n", cast(int)msg.length, msg.ptr); fflush(stderr); abort(); } }; }
For a per thread handler the following example may be what you want:
import core.thread; class MyThread : Thread { this( void function() fn, size_t sz = 0 ) @safe pure nothrow @nogc { super(fn, sz); } this( void delegate() dg, size_t sz = 0 ) @safe pure nothrow @nogc { super(dg, sz); } override void filterCaughtThrowable(ref Throwable t) @system nothrow { import core.stdc.stdio; import core.stdc.stdlib; if (auto e = cast(Error) t) { auto msg = e.message(); fprintf(stderr, "Thread death due to error: %.*s\n", cast(int)msg.length, msg.ptr); fflush(stderr); abort(); } super.filterCaughtThrowable(t); } }
Library changes
- Add lazyCache to std.algorithm.iteration
The new lazyCache function provides a lazily evaluated range caching mechanism. Unlike cache, which eagerly evaluates range elements during construction, lazyCache defers evaluation until elements are explicitly requested.
auto result = iota(-4, 5).map!(a => tuple(a, expensiveComputation(a)))().lazyCache(); // No computations performed at this point auto firstElement = result.front; // First element is now evaluated
See the std.algorithm.iteration.lazyCache documentation for more details.
- Add an internal multi-backend entropy system
This Phobos release introduces an internal multi-backend system for the retrieval of entropy (as in cryptographically-secure random numbers obtained from a suitable random number generator provided by the operating system).
The current implementation supports the getrandom syscall on Linux.
On BSD systems arc4random_buf or getentropy are used — depending on which is implemented by the OS and powered by a secure (non-RC4) algorithm.
Additionally, reading entropy from the character devices /dev/urandom and /dev/random is available on all POSIX targets.
On Windows BCryptGenRandom (from the Cryptography API: Next Generation (“BCrypt”)) is provided as a backend. CryptGenRandom from the legacy CryptoAPI is not supported for the time being.
Furthermore, this replaces the getrandom backwards compatibility shim that had been added by v2.111.1 for Linux targets. Instead backwards compatibility is now provided by a hunt strategy algorithm that tries potentially available entropy sources one by one to find one that is available on the running system. Given that the character devices serve as a fallback option here, urandom is favored over random. That is because modern kernel versions — where random would exhibit the usually more preferable behavior of blocking only until the entropy pool has been initialized — will also provide the getrandom syscall in the first place. Performing the syscall, in turn, is even better as it does not depend on the runtime environment exposing the special devices in predefined locations, thus working also within chroot environments.
- std.uni has been upgraded from Unicode 16.0.0 to 17.0.0
This Unicode update was released September 9, 2025, and adds new blocks with characters. See: https://www.unicode.org/versions/Unicode17.0.0/
import std; void main() { const alphaCount = iota(0, dchar.max).filter!(std.uni.isAlpha).walkLength; writeln(alphaCount); // formerly: 142759 // now: 147421 }
- Add uuid v7 support to std.uuid
Add uuid v7 support to the UUID type located in std.uuid. The first 48 bits of v7 stores the milliseconds since the unix epoch (1970-01-01), additionally 74 bit are used to store random data.
Example:
SysTime st = DateTime(2025, 8, 19, 10, 38, 45); UUID u = UUID(st); SysTime o = u.v7Timestamp(); assert(o == st); string s = u.toString(); UUID u2 = UUID(s); SysTime o2 = u2.v7Timestamp(); assert(o2 == st);
- variant: Support big structs with @disabled this()
std.variant didn't compile when the payload was a struct that was bigger than its internal buffer and had to be allocated on the heap if that struct @disabled this(). The new handling now always skips the constructor and just copies the directly to the allocated regions.
- Add writeText, writeWText, and writeDText to std.conv
These functions are variants of the existing text, wtext, and dtext functions. Instead of returning a string, they write their output to an output range.
Like text, writeText can accept an interpolated expression sequence as an argument.
Example:
import std.conv : writeText; import std.array : appender; auto output = appender!string(); output.writeText(i"2 + 2 == $(2 + 2)"); assert(output.data == "2 + 2 == 4");
Dub changes
- Added --dest command line build option.
Adds support for specifying a root directory for staging, essentially acts as a prefix to the targetPath and workingDirectory dubfile entries.
- Add frameworks dubfile key.
Adds support for specifying macOS frameworks to link against, this replaces the need to manually specify frameworks via lflags or dflags.
Before:
lflags "-framework" "Cocoa"
After:
frameworks "Cocoa" "OpenGL"
- Added --timeout option to dub dustmite command.
Adds a timeout (in seconds) for each oracle invocation, preventing the dustmite process from hanging indefinitely when the test command does not terminate. Requires the timeout command to be available (coreutils on Linux/macOS).
- Fix issue where cImportPaths wasn't working with dmd and ldc
dub was passing -I
instead of -P-I as is required by those compilers - dub.selections.json files are now looked up in parent directories too
In case the root package directory doesn't contain a dub.selections.json file, dub now looks in parent directories too and potentially uses the first (deepest) one it finds - if and only if that JSON file contains an optional new "inheritable": true flag.
This allows using a 'central' dub.selections.json file for a repository containing multiple dub projects, making it automatically apply to all builds in that source tree if located in the repository root directory (unless a local dub.selections.json overrides it).
Such an inherited selections file is never mutated when running dub for a nested project, i.e., changes are always saved to a local dub.selections.json file. E.g., when running dub upgrade for a nested project.
List of all bug fixes and enhancements in D 2.113.0:
Contributors to this release (79)
A huge thanks goes to all the awesome people who made this release possible.
- Aditya Singh
- AhmedMaged
- Albert24GG
- Anders Ronnbrant
- Andrei Alexandrescu
- Andrew Edwards
- Anton Oks
- apz28
- Aryan Dadwal
- Atila Neves
- Ayan Das
- Bastiaan Veelo
- Ben Jones
- blobbo
- Brad Anderson
- Brad Roberts
- Carlos Une
- Chris
- Claude Code
- Clouuday
- Clouudy
- dawg
- Dejan Lekic
- Denis Feklushkin
- Dennis
- Dennis Korpel
- eco
- Emmankoko
- Emmanuel Nyarko
- Eugene 'Vindex' Stulin
- Hiroki Noda
- Iain Buclaw
- Inkrementator
- Iskaban10
- Jacob Carlborg
- Johan Engelen
- John Colvin
- Jonathan M Davis
- Jordi Sayol
- Kai Meyer
- Leandro Lucarella
- limepoutine
- Lionello Lunesu
- Lio李歐
- Loren Burkholder
- Manuel Maier
- Martin Kinkelin
- Martin Nowak
- Mathias Lang
- Max H Haughton
- Max Haughton
- Mike Parker
- Mohamed El Shorbagy
- MoonlightSentinel
- naydef
- Nicholas Wilson
- Nick Sabalausky
- Nick Treleaven
- Paul Backus
- Per Nordlöw
- Petar Kirov
- Pranjal Kole
- ProgramGamer
- Quirin F. Schroll
- Rainer Schuetze
- Razvan Nitu
- Richard (Rikki) Andrew Cattermole
- RubyTheRoobster
- Sebastian Wilzbach
- Sergii K
- Sergii Kuzko
- Steven Schveighoffer
- Sönke Ludwig
- Tim Schendekehl
- Tony Edgin
- Tushar
- vindexbit
- Vladimir Panteleev
- Walter Bright