Skip to content

Commit 36b9641

Browse files
committed
Merge remote-tracking branch 'upstream/master' into stable
2 parents 23ad66c + ecc0573 commit 36b9641

15 files changed

+236
-120
lines changed

changelog/changelog.ddoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Log</option>
2222
VERSION=
2323
$(DIVC version,
2424
$(P
25-
$(B $(LARGE $(LINK2 http://downloads.dlang.org/releases/2.x/$(VER), Download D $(VER))))$(BR)
25+
$(B $(LARGE $(LINK2 https://downloads.dlang.org/releases/2.x/$(VER), Download D $(VER))))$(BR)
2626
$(SMALL released $1, $2)
2727
)
2828
$4

changelog/prerelease.ddoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
VERSION=
22
$(DIVC version,
33
$(P
4-
$(B $(LARGE $(LINK2 http://downloads.dlang.org/pre-releases/2.x/$(VER), Download D $(VER) Beta)))$(BR)
4+
$(B $(LARGE $(LINK2 https://downloads.dlang.org/pre-releases/2.x/$(VER), Download D $(VER) Beta)))$(BR)
55
$(SMALL to be released $1, $2)
66
)
77
$4

download.dd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $(TABLEC download-compilers,
99
)
1010
$(TR
1111
$(TD $(LINK2 #dmd, $(IMG compiler-dmd.png)))
12-
$(TD $(LINK2 http://gdcproject.org/downloads, $(IMG compiler-gdc.svg)))
12+
$(TD $(LINK2 https://gdcproject.org/downloads, $(IMG compiler-gdc.svg)))
1313
$(TD $(LINK2 https://github.com/ldc-developers/ldc#installation, $(IMG compiler-ldc.png)))
1414
)
1515
$(TR
@@ -35,7 +35,7 @@ $(TABLEC download-compilers,
3535
$(TD
3636
$(H3 LDC)
3737
$(UL
38-
$(LI $(LINK2 http://llvm.org/, LLVM)-based D compiler)
38+
$(LI $(LINK2 https://llvm.org/, LLVM)-based D compiler)
3939
$(LI Strong optimization)
4040
$(LI
4141
$(LINK2 https://wiki.dlang.org/Build_D_for_Android, Android support)
@@ -49,7 +49,7 @@ $(TABLEC download-compilers,
4949
$(DIVC download-link, $(LINK2 dmd-windows.html, About) &middot; $(LINK2 #dmd, Download))
5050
)
5151
$(TD
52-
$(DIVC download-link, $(LINK2 http://gdcproject.org/, About) &middot; $(LINK2 http://gdcproject.org/downloads, Download))
52+
$(DIVC download-link, $(LINK2 https://gdcproject.org/, About) &middot; $(LINK2 https://gdcproject.org/downloads, Download))
5353
)
5454
$(TD
5555
$(DIVC download-link, $(LINK2 https://wiki.dlang.org/LDC, About) &middot; $(LINK2 https://github.com/ldc-developers/ldc#installation, Download))
@@ -131,7 +131,7 @@ $(DIVC download_channels,
131131
)
132132

133133
$(H3
134-
$(LINK2 http://downloads.dlang.org, Release Archive)
134+
$(LINK2 https://downloads.dlang.org, Release Archive)
135135
)
136136
$(LINK2 gpg_keys.html, GPG keys)$(BR)
137137
$(LINK2 https://github.com/dlang, D on GitHub)
@@ -153,7 +153,7 @@ $(DOWNLOAD_OTHER $(NIX), $(LINK2 https://search.nixos.org/packages?show=dmd&quer
153153
$(LINK2 https://github.com/dukc/oldDDerivations, derivations for building various versions yourself)
154154
)
155155

156-
$(DOWNLOAD_OTHER $(UBUNTU) $(DEBIAN), Ubuntu/Debian, $(LINK2 http://d-apt.sourceforge.net/, APT repository)
156+
$(DOWNLOAD_OTHER $(UBUNTU) $(DEBIAN), Ubuntu/Debian, $(LINK2 https://d-apt.sourceforge.net/, APT repository)
157157
$(CONSOLE sudo wget https://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list
158158
sudo apt-get update --allow-insecure-repositories
159159
sudo apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring
@@ -188,9 +188,9 @@ $(H2 Other Downloads)
188188
$(UL
189189
$(LI $(LINK2 https://github.com/dlang/visuald/releases, VisualD - D Plugin for Visual Studio))
190190

191-
$(LI $(LINK2 http://dlang.org/spec/spec.html, D Programming Language Specification): $(BTN https://dlang.org/dlangspec.mobi, mobi))
191+
$(LI $(LINK2 https://dlang.org/spec/spec.html, D Programming Language Specification): $(BTN https://dlang.org/dlangspec.mobi, mobi))
192192

193-
$(LI $(LINK2 http://www.digitalmars.com/download/freecompiler.html, Digital Mars C and C++ Compiler Downloads))
193+
$(LI $(LINK2 https://www.digitalmars.com/download/freecompiler.html, Digital Mars C and C++ Compiler Downloads))
194194
)
195195
)
196196

@@ -247,8 +247,8 @@ Macros:
247247
SBTN=$(SPANC sig_btn,$(BTN $1,$+)<br>$(BTN $1.sig,sig))
248248
BTN=<a href="$1" class="btn">$+</a>
249249
H3I=<h3 class="download">$0</h3>
250-
DLSITE=https://s3.us-west-2.amazonaws.com/downloads.dlang.org/releases/2022/$0
251-
B_DLSITE=https://s3.us-west-2.amazonaws.com/downloads.dlang.org/pre-releases/2022/$0
250+
DLSITE=https://downloads.dlang.org/releases/2022/$0
251+
B_DLSITE=https://downloads.dlang.org/pre-releases/2022/$0
252252
DOWNLOAD =
253253
$(DIV,
254254
$(DIVC download_image, $2)

js/platform-downloads.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
var html = '';
3131
for (var i = 0; i < files.length; ++i) {
3232
var f = files[i];
33-
var url = 'https://s3.us-west-2.amazonaws.com/downloads.dlang.org/releases/2022/' + f.name + f.suffix;
33+
var url = 'https://downloads.dlang.org/releases/2022/' + f.name + f.suffix;
3434
html += '<a href="' + url + '" class="btn action">Download ' + f.text + '</a>';
3535
}
3636
if (files.length > 1) {

posix.mak

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ DOC_OUTPUT_DIR:=$(PWD)/web
166166
W:=$(DOC_OUTPUT_DIR)
167167
GIT_HOME=https://github.com/dlang
168168
DPL_DOCS_PATH=dpl-docs
169-
DPL_DOCS=$(DPL_DOCS_PATH)/dpl-docs --DRT-gcopt=parallel:0
169+
DPL_DOCS=$(DPL_DOCS_PATH)/dpl-docs
170+
DPL_DOCS_FLAGS=--DRT-gcopt=parallel:0
170171
REMOTE_DIR=d-programming@digitalmars.com:data
171172
TMP?=/tmp
172173
GENERATED=.generated
@@ -687,20 +688,20 @@ $(PHOBOS_LIB): $(DMD)
687688
apidocs-prerelease : $W/library-prerelease/sitemap.xml $W/library-prerelease/.htaccess
688689
apidocs-latest : $W/library/sitemap.xml $W/library/.htaccess
689690
apidocs-serve : $G/docs-prerelease.json
690-
${DPL_DOCS} serve-html --std-macros=html.ddoc --std-macros=dlang.org.ddoc --std-macros=std.ddoc --std-macros=macros.ddoc --std-macros=std-ddox.ddoc \
691+
${DPL_DOCS} ${DPL_DOCS_FLAGS} serve-html --std-macros=html.ddoc --std-macros=dlang.org.ddoc --std-macros=std.ddoc --std-macros=macros.ddoc --std-macros=std-ddox.ddoc \
691692
--override-macros=std-ddox-override.ddoc --package-order=std \
692693
--git-target=master --web-file-dir=. $<
693694

694695
$W/library-prerelease/sitemap.xml : $G/docs-prerelease.json
695696
@mkdir -p $(dir $@)
696-
${DPL_DOCS} generate-html --file-name-style=lowerUnderscored --std-macros=html.ddoc --std-macros=dlang.org.ddoc --std-macros=std.ddoc --std-macros=macros.ddoc --std-macros=std-ddox.ddoc \
697+
${DPL_DOCS} ${DPL_DOCS_FLAGS} generate-html --file-name-style=lowerUnderscored --std-macros=html.ddoc --std-macros=dlang.org.ddoc --std-macros=std.ddoc --std-macros=macros.ddoc --std-macros=std-ddox.ddoc \
697698
--override-macros=std-ddox-override.ddoc --package-order=std \
698699
--git-target=master $(DPL_DOCS_PATH_RUN_FLAGS) \
699700
$< $W/library-prerelease
700701

701702
$W/library/sitemap.xml : $G/docs-latest.json
702703
@mkdir -p $(dir $@)
703-
${DPL_DOCS} generate-html --file-name-style=lowerUnderscored --std-macros=html.ddoc --std-macros=dlang.org.ddoc --std-macros=std.ddoc --std-macros=macros.ddoc --std-macros=std-ddox.ddoc \
704+
${DPL_DOCS} ${DPL_DOCS_FLAGS} generate-html --file-name-style=lowerUnderscored --std-macros=html.ddoc --std-macros=dlang.org.ddoc --std-macros=std.ddoc --std-macros=macros.ddoc --std-macros=std-ddox.ddoc \
704705
--override-macros=std-ddox-override.ddoc --package-order=std \
705706
--git-target=v${LATEST} $(DPL_DOCS_PATH_RUN_FLAGS) \
706707
$< $W/library
@@ -724,7 +725,7 @@ $G/docs-latest.json : ${DMD_LATEST} ${DMD_LATEST_DIR} \
724725
${DMD_LATEST} -J$(DMD_LATEST_DIR)/src/dmd/res -J$(dir $(DMD_LATEST)) -c -o- -version=CoreDdoc \
725726
-version=MARS -version=CoreDdoc -version=StdDdoc -Df$G/.latest-dummy.html \
726727
-Xf$@ -I${PHOBOS_LATEST_DIR} @$G/.latest-files.txt
727-
${DPL_DOCS} filter $@ --min-protection=Protected \
728+
${DPL_DOCS} ${DPL_DOCS_FLAGS} filter $@ --min-protection=Protected \
728729
--only-documented $(MOD_EXCLUDES_LATEST)
729730
rm -f $G/.latest-files.txt $G/.latest-dummy.html
730731

@@ -738,7 +739,7 @@ $G/docs-prerelease.json : ${DMD} ${DMD_DIR} ${DRUNTIME_DIR} | dpl-docs
738739
${DMD} -J$(DMD_DIR)/res -J$(DMD_DIR)/compiler/src/dmd/res -J$(dir $(DMD)) -c -o- -version=MARS -version=CoreDdoc \
739740
-version=StdDdoc -Df$G/.prerelease-dummy.html \
740741
-Xf$@ -I${PHOBOS_DIR} @$G/.prerelease-files.txt
741-
${DPL_DOCS} filter $@ --min-protection=Protected \
742+
${DPL_DOCS} ${DPL_DOCS_FLAGS} filter $@ --min-protection=Protected \
742743
--only-documented $(MOD_EXCLUDES_PRERELEASE)
743744
rm -f $G/.prerelease-files.txt $G/.prerelease-dummy.html
744745

spec/arrays.dd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,8 @@ Returns an array literal with each element of the literal being the $(D .init) p
576576
the number of bytes per array element.)
577577
$(TROW $(D .length), Returns the number of elements in the array.
578578
This is a fixed quantity for static arrays. It is of type $(D size_t).)
579+
$(TROW $(D .capacity), Returns the number of elements that can be appended to the array without reallocating.
580+
$(D .capacity) is always $(D 0) for static arrays because their size cannot be modified.)
579581
$(TROW $(D .ptr), Returns a pointer to the first element of the array.)
580582
$(TROW $(D .dup), Create a dynamic array of the same size and copy the contents of the array into it. The copy will have any immutability or const stripped. If this conversion is invalid the call will not compile.)
581583
$(TROW $(D .idup), Create a dynamic array of the same size and copy the contents of the array into it. The copy is typed as being immutable. If this conversion is invalid the call will not compile.)
@@ -605,6 +607,7 @@ Returns an array literal with each element of the literal being the $(D .init) p
605607
which is 8 in 32-bit builds and 16 on 64-bit builds.))
606608
$(TROW $(D .length), Get/set number of elements in the
607609
array. It is of type $(D size_t).)
610+
$(TROW $(D .capacity), Returns the number of elements that can be appended to the array without reallocating.)
608611
$(TROW $(D .ptr), Returns a pointer to the first element of the array.)
609612
$(TROW $(D .dup), Create a dynamic array of the same size and copy the contents of the array into it. The copy will have any immutability or const stripped. If this conversion is invalid the call will not compile.)
610613
$(TROW $(D .idup), Create a dynamic array of the same size and copy the contents of the array into it. The copy is typed as being immutable. If this conversion is invalid the call will not compile.)

spec/class.dd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ void main()
11961196
$(P Multiple $(I AliasThis) are currently not allowed.)
11971197

11981198
$(H2 $(LNAME2 auto, Scope Classes))
1199-
$(B Note): Scope classes have been $(DDSUBLINK deprecate, scope for allocating classes on the stack, recommended for deprecation).
1199+
$(B Note): Scope classes have been $(DDSUBLINK deprecate, scope as a type constraint, recommended for deprecation).
12001200

12011201
$(P A scope class is a class with the $(D scope) attribute, as in:)
12021202

spec/entity.dd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ $(GNAME NamedCharacterEntity):
1111

1212
$(P The full list of named character entities from the
1313
$(LINK2 https://w3.org/TR/html5/syntax.html#named-character-references, HTML 5 Spec)
14-
is supported
15-
except for the named entities which contain multiple code points.
14+
is supported.
15+
Named entities which contain multiple code points can only be used in string literals,
16+
not in character literals, since they do not fit in any character type.
1617
Below is a $(I partial) list of the named character entities.
1718
)
1819

spec/expression.dd

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,23 +1511,30 @@ $(GNAME Slice):
15111511
$(H3 $(LNAME2 slice_to_static_array, Slice Conversion to Static Array))
15121512

15131513
$(P If the slice bounds can be known at compile time, the slice expression
1514-
may be implicitly convertible to an lvalue of static array. For example:)
1514+
may be implicitly convertible to a static array lvalue. For example:)
15151515

15161516
-------------
15171517
arr[a .. b] // typed T[]
15181518
-------------
15191519

1520+
$(P
15201521
If both $(CODE a) and $(CODE b) are integers (which may be constant-folded),
15211522
the slice expression can be converted to a static array of type
15221523
$(D T[b - a]).
1524+
)
1525+
$(NOTE a static array can also be $(DDSUBLINK spec/arrays, assignment,
1526+
assigned from a slice), performing a runtime check that the lengths match.)
15231527

1524-
$(SPEC_RUNNABLE_EXAMPLE_RUN
1528+
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
15251529
---
1530+
void f(int[2] sa);
1531+
15261532
int[] arr = [1, 2, 3];
1527-
int[2] sa = arr[1 .. 3];
1533+
//f(arr); // error, can't convert
1534+
f(arr[1 .. 3]); // OK
1535+
//f(arr[0 .. 3]); // error
15281536

1529-
assert(sa == [2, 3]);
1530-
//sa = arr[0 .. 3]; // error, cannot match length
1537+
int[2] g() { return arr[0 .. 2]; }
15311538
---
15321539
)
15331540

@@ -1550,16 +1557,17 @@ $(H3 $(LNAME2 slice_to_static_array, Slice Conversion to Static Array))
15501557
-------------
15511558
)
15521559

1560+
$(COMMENT Not implemented yet - https://issues.dlang.org/show_bug.cgi?id=13700
15531561
$(P Certain other forms of slice expression can be implicitly converted to a static array
1554-
when the slice length can be known at compile-time.
1562+
when the slice length can be known at compile-time.)
15551563

1556-
$(SPEC_RUNNABLE_EXAMPLE_RUN
1564+
$(COMMENT SPEC_RUNNABLE_EXAMPLE_RUN
15571565
-------------
15581566
int[] da = [1, 2, 3];
15591567
int i = da[0]; // runtime variable
15601568

1561-
int[2] sa = da[i .. i + 2];
1562-
assert(sa == [2, 3]);
1569+
int[2] f() { return da[i .. i + 2]; }
1570+
assert(f() == [2, 3]);
15631571
-------------
15641572
)
15651573

@@ -1580,6 +1588,7 @@ $(H3 $(LNAME2 slice_to_static_array, Slice Conversion to Static Array))
15801588
$(TROW $(D arr[e+a .. e+b]), $(D b - a) $(I if) $(D a <= b))
15811589
$(TROW $(D arr[e-a .. e-b]), $(D a - b) $(I if) $(D a >= b))
15821590
)
1591+
)
15831592

15841593
$(H2 $(LNAME2 primary_expressions, Primary Expressions))
15851594

@@ -1894,9 +1903,9 @@ $(H3 $(LNAME2 function_literals, Function Literals))
18941903

18951904
$(GRAMMAR
18961905
$(GNAME FunctionLiteral):
1897-
$(D function) $(D ref)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithAttributes)$(OPT) $(GLINK FunctionLiteralBody2)
1898-
$(D delegate) $(D ref)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithMemberAttributes)$(OPT) $(GLINK FunctionLiteralBody2)
1899-
$(D ref)$(OPT) $(GLINK ParameterWithMemberAttributes) $(GLINK FunctionLiteralBody2)
1906+
$(D function) $(GLINK RefOrAutoRef)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithAttributes)$(OPT) $(GLINK FunctionLiteralBody2)
1907+
$(D delegate) $(GLINK RefOrAutoRef)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithMemberAttributes)$(OPT) $(GLINK FunctionLiteralBody2)
1908+
$(GLINK RefOrAutoRef)$(OPT) $(GLINK ParameterWithMemberAttributes) $(GLINK FunctionLiteralBody2)
19001909
$(GLINK2 statement, BlockStatement)
19011910
$(IDENTIFIER) $(D =>) $(GLINK AssignExpression)
19021911

@@ -1909,6 +1918,10 @@ $(GNAME ParameterWithMemberAttributes):
19091918
$(GNAME FunctionLiteralBody2):
19101919
$(D =>) $(GLINK AssignExpression)
19111920
$(GLINK2 function, SpecifiedFunctionBody)
1921+
1922+
$(GNAME RefOrAutoRef):
1923+
$(D ref)
1924+
$(D auto ref)
19121925
)
19131926

19141927
$(P $(I FunctionLiteral)s (also known as $(LNAME2 lambdas, $(I Lambdas))) enable embedding anonymous functions
@@ -2358,9 +2371,44 @@ $(GNAME ArgumentList):
23582371
collected) heap.
23592372
)
23602373

2361-
$(P If a $(I NewExpression) is used as an initializer for
2374+
$(P The *Type* form constructs an instance of a type and default-initializes it.)
2375+
$(P The *Type(ArgumentList)* form allows passing either a single initializer
2376+
of the same type, or multiple arguments for more complex types.
2377+
For class types, *ArgumentList* is passed to the class constructor.
2378+
For a dynamic array, the argument sets the initial array length.
2379+
For multidimensional dynamic arrays, each argument corresponds to
2380+
an initial length.)
2381+
2382+
$(SPEC_RUNNABLE_EXAMPLE_RUN
2383+
---
2384+
int* i = new int;
2385+
assert(*i == 0);
2386+
i = new int(5);
2387+
assert(*i == 5);
2388+
2389+
Object o = new Object;
2390+
Exception e = new Exception("info");
2391+
2392+
auto a = new int[](2);
2393+
assert(a.length == 2);
2394+
2395+
int[][] m = new int[][](10, 5);
2396+
assert(m.length == 10);
2397+
assert(m[0].length == 5);
2398+
---
2399+
)
2400+
2401+
$(P The *Type[AssignExpression]* form allocates a dynamic array with
2402+
length equal to *AssignExpression*.
2403+
It is preferred to use the *Type(ArgumentList)* form when allocating
2404+
dynamic arrays instead, as it is more general.)
2405+
2406+
$(NOTE It is not possible to allocate a static array directly with
2407+
`new` (only by using a type alias).)
2408+
2409+
$(P If a $(I NewExpression) is used with a class type as an initializer for
23622410
a function local variable with $(DDSUBLINK spec/attribute, scope, `scope`) storage class,
2363-
then the instance is allocated on the stack.
2411+
then the instance is $(DDSUBLINK spec/attribute, scope-class-var, allocated on the stack).
23642412
)
23652413

23662414
$(P `new` can also be used to allocate a

0 commit comments

Comments
 (0)