Change Log: 2.105.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
- Better error message when attribute inference fails down the call stack
- Using ; as an empty statement has been turned into an error
- Using in parameters with non extern(D)/extern(C++) functions is deprecated
- in ref on parameters has been deprecated in favor of -preview=in
- Throwing qualified objects is now deprecated
- User Defined Attributes now parse Template Arguments
Library changes
Tools changes
List of all upcoming bug fixes and enhancements in D 2.105.0.
Compiler changes
- Better error message when attribute inference fails down the call stack
When a function fails to infer a function attribute, all callers of that function also fail to infer the attribute. The resulting error message only points to the top most function with the explicit attribute:
void main() @nogc { fun(); } auto fun() { funImpl(); } auto funImpl() { int[] a = [1, 2, 3]; }
app.d(4): Error: @nogc function D main cannot call non-@nogc function app.fun
This doesn't tell the underlying reason why fun wasn't inferred @nogc, and led to use of workarounds to get better information. The new error message will point to the function which failed to infer the attribute:
app.d(4): Error: @nogc function D main cannot call non-@nogc function app.fun app.d(7): which calls app.funImpl app.d(14): which wasn't inferred @nogc because of: app.d(14): array literal in @nogc function app.funImpl may cause a GC allocation
Note: this was already implemented for @safe since 2.101, but it has now been extended to @nogc, nothrow, and pure.
- Using ; as an empty statement has been turned into an error
This has been deprecated since 2.075.0 because it's error prone:
void main() { foreach (i; 0 .. 8); { // Because of the accidental semicolon above, // this block statement is executed once. // It's not the loop body } }
It will now result in an error.
app.d(3): Error: use { } for an empty statement, not ;
- Using in parameters with non extern(D)/extern(C++) functions is deprecated
In preparation for enabling -preview=in by default, using in parameters on function that have neither D nor C++ linkage is deprecated. Users can replace instances of in with either const or scope const. Refer to v2.101.0 changelog's for a full rationale.
- in ref on parameters has been deprecated in favor of -preview=in
Using in ref (or ref in) on function parameters will now yield a deprecation. Users are encouraged to remove the ref and compile with -preview=in, which will infer whether the parameter should be passed by reference or value. Users wanting a specific ABI are encouraged to use scope const ref instead. Note that this also applies to auto ref in, which is equivalent to in with -preview=in, but the latter doesn't require the function to be templated.
- Throwing qualified objects is now deprecated
Previously, an immutable, const, inout or shared exception could be thrown and then caught in an unqualified catch (Exception e) clause. That breaks type safety. Throwing a qualified object is now deprecated. This helps to prevent possible mutation of an immutable object in a catch clause.
The runtime also modifies a thrown object (e.g. to contain a stack trace) which can violate const or immutable objects. Throwing qualified objects has been deprecated for this reason also.
- User Defined Attributes now parse Template Arguments
It was already allowed to put types in UDAs, but the parser would reject basic types written directly, requiring the use of an alias.
alias Tint = int; @Tint void f();
Also, simple literals that can appear in template instantiations without brackets (example: foo!"arg") require parentheses when used as an attribute:
@("my test") unittest { }
Now, arguments that can appear after a template instantiation foo! can also appear after an @ attribute.
@int void f(); @"my test" unittest { }
Library changes
- Better static assert messages for std.algorithm.comparison.clamp
Until now, clamp used a template constraint to check if the passed types could be used. If they were not, it was very tedious to figure out why.
As the template constraint is not used for overload resolution the constrains are moved into static asserts with expressive error messages.
- std.typecons.Rebindable now supports all types
Rebindable can now be used to store and rebind values of any type, including immutable struct values.
To ensure const safety is preserved, the stored values cannot be accessed by reference.
The implementation used for all previously supported types (classes, interfaces and arrays) is unchanged.
Tools changes
- rdmd supports -shared
rdmd now understands DMD's -shared switch, and sets the default output file name appropriately (.dll, .so, or .dylib depending on the platform), in the same way as -lib.
List of all bug fixes and enhancements in D 2.105.0:
DMD Compiler regression fixes
- Bugzilla 22427: betterC: casting an array causes linker error in string comparison.
- Bugzilla 23965: [REG2.101.0] Appending deprecated structs in deprecated function causes deprecation message
- Bugzilla 23966: [REG2.102] Cannot use traits(getAttributes) with overloaded template
- Bugzilla 23978: [REG 2.103.0] ICE: dip1021 memory corruption
- Bugzilla 23979: ICE on failed alias this attempt on pointer expression
- Bugzilla 24013: [REG 2.103.0] address of a __traits(getOverloads) item is not converted to a delegate anymore
- Bugzilla 24018: array concatenation doesn't work with disabled default construction
- Bugzilla 24026: ImportC: ICE on nested C initializer 2
DMD Compiler bug fixes
- Bugzilla 7184: parse error on *(x)++
- Bugzilla 11612: Inconsistent error on negative new array size
- Bugzilla 13063: enum is allowed as storage class for functions
- Bugzilla 16384: Invariant not called with multiple defined.
- Bugzilla 18528: dmd should deduplicate identical errors
- Bugzilla 20008: __traits(allMembers) of packages is complete nonsense
- Bugzilla 20687: Allow member function address as const initializer
- Bugzilla 21025: Segfault for function contract -preview=dip1021
- Bugzilla 21415: catch immutable exceptions breaks immutable
- Bugzilla 21425: Using va_start twice results in wrong values
- Bugzilla 22729: ICE: Invalid array access for invalid interface definition
- Bugzilla 23279: Segmentation fault on mixin template + using unknown type
- Bugzilla 23719: runnable/test22071.c:22:16: error: ‘abc’ is a pointer; did you mean to use ‘->’?
- Bugzilla 23768: ImportC: ICE on nested C initializer
- Bugzilla 23857: backend inliner takes too long on recursive function call
- Bugzilla 23870: ImportC doesn't accept '' followed by newline, whereas VC does
- Bugzilla 23875: ImportC: __attribute__ in a cast doesn't work
- Bugzilla 23879: ImportC: Windows system headers use __alignof
- Bugzilla 23880: ImportC: __attribute__((vector_size(N))) is not implemented
- Bugzilla 23885: [CI] C++ interop tests with g++ fail
- Bugzilla 23900: @safe is allowed in inline asm
- Bugzilla 23908: confusing nonexistent import hint on cyclic import
- Bugzilla 23912: Destructor disables scope inference
- Bugzilla 23914: "auto ref" resolution on return value prevented by noreturn (bottom type)
- Bugzilla 23935: ImportC: __pragma not allowed between struct and tag name
- Bugzilla 23936: ImportC: pragma pack is not working for structs
- Bugzilla 23947: If a class overloads a method mixing private and public and the last overload is public, the method is always public.
- Bugzilla 23951: "alias this" not properly dereferenced when the object being looked up is a field of a type
- Bugzilla 23968: Deprecation not emitted with alias to template function in UFCS
- Bugzilla 23982: segfault when printing scope inference failure
- Bugzilla 23986: ICE: dip1021 asserts on typeof(null) parameter
- Bugzilla 23988: Conditional Exp does not bring enums to correct common type if one leg is const
- Bugzilla 24010: Destructor called before end of scope for tuples
- Bugzilla 24017: [UFCS] Bypassing nothrow with debug doesn’t work
- Bugzilla 24024: cannot pass class this to ref class
- Bugzilla 24025: Expressions contained in parentheses should not be assumed to be C casts
- Bugzilla 24027: error: instantiated from here: maxElement!("a.a", A[])
- Bugzilla 24029: ImportC: symbol name clash on statement expressions
DMD Compiler enhancements
- Bugzilla 4663: Wrong 'static' position error message
- Bugzilla 15436: Compiler still refers to AliasSeq-s as "tuple"-s (and TypeTuple?)
- Bugzilla 23475: confusing printf deprecation message with ulong/long on Windows
- Bugzilla 23871: ImportC: __attribute not recognized
- Bugzilla 23877: ImportC: Importing byteswap.h results in undefined reference to core.bitop.byteswap
- Bugzilla 23886: ImportC preprocessor directive #ident not supported
- Bugzilla 23928: improve error msg: scope variable s assigned to non-scope parameter this calling abc
- Bugzilla 23931: Error: reference to local variable this calling non-scope member function this.this()
- Bugzilla 23948: __FILE__ and __MODULE__ cannot be implicitly converted to const(char)* as default paramenter
- Bugzilla 23971: Provide clearer error message when trying to return a slice with C++ linkage
- Bugzilla 24000: show the open bracket "{" location for Error: matching } expected, not End of File
- Bugzilla 24023: Unnecessary module prefix in error message types
Phobos regression fixes
- Bugzilla 23976: std.range.slide fails in dmd-2.104.0
- Bugzilla 23993: std.algorithm.maxElement no longer works with array of BigInt
Phobos bug fixes
- Bugzilla 23361: std.uni.normalize should be pure
- Bugzilla 23844: chain(only) doesn't support immutable structs
- Bugzilla 23940: std.getopt does not assert with options that only differ in case with config.caseInsensitive
- Bugzilla 23997: isClose(1, -double.infinity) returns true
- Bugzilla 24028: BigInt power operator ignores sign of exponent
Phobos enhancements
- Bugzilla 23881: std.system has no function for system architecture
- Bugzilla 23922: [std.socket]
Druntime regression fixes
- Bugzilla 23890: "Warning: cannot inline function" in core.lifetime
Druntime bug fixes
- Bugzilla 23312: Crash when calling writeln in WinMain
Druntime enhancements
- Bugzilla 23980: OpenBSD: Add getthrname(2) and setthrname(2) to unistd.d
- Bugzilla 24044: Support float opCmp(...) with array
dlang.org bug fixes
- Bugzilla 23692: ImportC: __pragma and __declspec are not documented as supported Visual C extensions
- Bugzilla 23697: No examples of invalid forward references in C code accepted by ImportC
- Bugzilla 23946: specifications state that "there can only be one destructor" which can be confusing because of mixin templates
dlang.org enhancements
- Bugzilla 5636: Array ops use lexicographic comparison instead of vector-style element-wise
- Bugzilla 23571: Discussion of manifest constants in enum documentation is confusing at best
Contributors to this release (36)
A huge thanks goes to all the awesome people who made this release possible.
- Amaury
- Ate Eskola
- Atila Neves
- Basile Burg
- Boris Carvajal
- Brian Callahan
- Cameron Ross
- Dante Broggi
- Dennis
- Dennis Korpel
- Dmytro Katyukha
- Ernesto Castellotti
- FeepingCreature
- Iain Buclaw
- Jacob Carlborg
- Jan Jurzitza
- Johan Engelen
- Lucian Danescu
- Lucipetus
- Luís Ferreira
- Martin Kinkelin
- Mathis Beer
- mhh
- Mike Parker
- Nicholas Wilson
- Nick Treleaven
- Paul Backus
- Petar Kirov
- Quirin F. Schroll
- Razvan Nitu
- Richard (Rikki) Andrew Cattermole
- Robert burner Schadek
- Teodor Dutu
- Tim Schendekehl
- Vladimir Panteleev
- Walter Bright