Skip to content

Commit 65f0633

Browse files
committed
---
yaml --- r: 229162 b: refs/heads/try c: f7eecc9 h: refs/heads/master v: v3
1 parent 99d56be commit 65f0633

File tree

163 files changed

+2198
-1088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2198
-1088
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 1d3818ab7caa11d0244ce87ac09250a49db6392d
4+
refs/heads/try: f7eecc93f34cbeee52dca319b59474824b15c17e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ sudo: false
2020
before_script:
2121
- ./configure --enable-ccache
2222
script:
23-
- make tidy
24-
- make rustc-stage1 -j4
23+
- make tidy check -j4
2524

2625
env:
2726
- CXX=/usr/bin/g++-4.7

branches/try/RELEASES.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Highlights
1616
jobs). It's not enabled by default, but will be "in the near
1717
future". It can be activated with the `-C codegen-units=N` flag to
1818
`rustc`.
19+
* This is the first release with [experimental support for linking
20+
with the MSVC linker and lib C on Windows (instead of using the GNU
21+
variants via MinGW)][win]. It is yet recommended only for the most
22+
intrepid Rusticians.
23+
* Benchmark compilations are showing a 30% improvement in
24+
bootstrapping over 1.1.
1925

2026
Breaking Changes
2127
----------------
@@ -31,6 +37,10 @@ Breaking Changes
3137
* [The `#[packed]` attribute is no longer silently accepted by the
3238
compiler][packed]. This attribute did nothing and code that
3339
mentioned it likely did not work as intended.
40+
* Associated type defaults are [now behind the
41+
`associated_type_defaults` feature gate][ad]. In 1.1 associated type
42+
defaults *did not work*, but could be mentioned syntactically. As
43+
such this breakage has minimal impact.
3444

3545
Language
3646
--------
@@ -46,12 +56,11 @@ Libraries
4656
`LinkedList`, `VecDeque`, `EnumSet`, `BinaryHeap`, `VecMap`,
4757
`BTreeSet` and `BTreeMap`. [RFC][extend-rfc].
4858
* The [`iter::once`] function returns an iterator that yields a single
49-
element.
50-
* The [`iter::empty`] function returns an iterator that yields no
59+
element, and [`iter::empty`] returns an iterator that yields no
5160
elements.
5261
* The [`matches`] and [`rmatches`] methods on `str` return iterators
5362
over substring matches.
54-
* [`Cell`] and [`RefCell`] both implement [`Eq`].
63+
* [`Cell`] and [`RefCell`] both implement `Eq`.
5564
* A number of methods for wrapping arithmetic are added to the
5665
integral types, [`wrapping_div`], [`wrapping_rem`],
5766
[`wrapping_neg`], [`wrapping_shl`], [`wrapping_shr`]. These are in
@@ -144,6 +153,8 @@ Misc
144153
[dst]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md
145154
[parcodegen]: https://github.com/rust-lang/rust/pull/26018
146155
[packed]: https://github.com/rust-lang/rust/pull/25541
156+
[ad]: https://github.com/rust-lang/rust/pull/27382
157+
[win]: https://github.com/rust-lang/rust/pull/25350
147158

148159
Version 1.1.0 (June 2015)
149160
=========================

branches/try/mk/ctags.mk

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,11 @@
1515

1616
.PHONY: TAGS.emacs TAGS.vi
1717

18-
# This is using a blacklist approach, probably more durable than a whitelist.
19-
# We exclude: external dependencies (llvm, rt/{msvc,vg}),
20-
# tests (compiletest, test) and a couple of other things (rt/arch, etc)
21-
CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/llvm,, \
22-
$(patsubst ${CFG_SRC_DIR}src/compiletest,, \
23-
$(patsubst ${CFG_SRC_DIR}src/test,, \
24-
$(patsubst ${CFG_SRC_DIR}src/etc,, \
25-
$(patsubst ${CFG_SRC_DIR}src/rt,, \
26-
$(patsubst ${CFG_SRC_DIR}src/rt/arch,, \
27-
$(patsubst ${CFG_SRC_DIR}src/rt/msvc,, \
28-
$(patsubst ${CFG_SRC_DIR}src/rt/vg,, \
29-
$(wildcard ${CFG_SRC_DIR}src/*) $(wildcard ${CFG_SRC_DIR}src/rt/*) \
30-
))))))))
31-
CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=-javascript --recurse ${CTAGS_LOCATIONS}
32-
# We could use `--languages=Rust`, but there is value in producing tags for the
33-
# C++ parts of the code base too (at the time of writing, those are .h and .cpp
34-
# files in src/rt, src/rt/sync and src/rustllvm); we mainly just want to
35-
# exclude the external dependencies.
18+
CTAGS_LOCATIONS=$(wildcard ${CFG_SRC_DIR}src/lib*)
19+
CTAGS_LOCATIONS=$(patsubst ${CFG_SRC_DIR}src/librust%,, \
20+
$(patsubst ${CFG_SRC_DIR}src/lib%test,, \
21+
$(wildcard ${CFG_SRC_DIR}src/lib*))) ${CFG_SRC_DIR}src/libtest
22+
CTAGS_OPTS=--options="${CFG_SRC_DIR}src/etc/ctags.rust" --languages=Rust --recurse ${CTAGS_LOCATIONS}
3623

3724
TAGS.emacs:
3825
ctags -e -f $@ ${CTAGS_OPTS}

branches/try/mk/docs.mk

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE)
7777

7878
D := $(S)src/doc
7979

80-
DOC_TARGETS := trpl tarpl style error-index
80+
DOC_TARGETS := trpl nomicon style error-index
8181
COMPILER_DOC_TARGETS :=
8282
DOC_L10N_TARGETS :=
8383

@@ -287,12 +287,12 @@ doc/book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/trpl/*.md) | doc/
287287
$(Q)rm -rf doc/book
288288
$(Q)$(RUSTBOOK) build $(S)src/doc/trpl doc/book
289289

290-
tarpl: doc/adv-book/index.html
290+
nomicon: doc/nomicon/index.html
291291

292-
doc/adv-book/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/tarpl/*.md) | doc/
292+
doc/nomicon/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/nomicon/*.md) | doc/
293293
@$(call E, rustbook: $@)
294-
$(Q)rm -rf doc/adv-book
295-
$(Q)$(RUSTBOOK) build $(S)src/doc/tarpl doc/adv-book
294+
$(Q)rm -rf doc/nomicon
295+
$(Q)$(RUSTBOOK) build $(S)src/doc/nomicon doc/nomicon
296296

297297
style: doc/style/index.html
298298

branches/try/mk/tests.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ $(foreach doc,$(DOCS), \
162162
$(eval $(call DOCTEST,md-$(doc),$(S)src/doc/$(doc).md)))
163163
$(foreach file,$(wildcard $(S)src/doc/trpl/*.md), \
164164
$(eval $(call DOCTEST,$(file:$(S)src/doc/trpl/%.md=trpl-%),$(file))))
165-
$(foreach file,$(wildcard $(S)src/doc/tarpl/*.md), \
166-
$(eval $(call DOCTEST,$(file:$(S)src/doc/tarpl/%.md=tarpl-%),$(file))))
165+
$(foreach file,$(wildcard $(S)src/doc/nomicon/*.md), \
166+
$(eval $(call DOCTEST,$(file:$(S)src/doc/nomicon/%.md=nomicon-%),$(file))))
167167
######################################################################
168168
# Main test targets
169169
######################################################################
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
% The Rustonomicon
2+
3+
#### The Dark Arts of Advanced and Unsafe Rust Programming
4+
5+
# NOTE: This is a draft document, and may contain serious errors
6+
7+
> Instead of the programs I had hoped for, there came only a shuddering blackness
8+
and ineffable loneliness; and I saw at last a fearful truth which no one had
9+
ever dared to breathe before — the unwhisperable secret of secrets — The fact
10+
that this language of stone and stridor is not a sentient perpetuation of Rust
11+
as London is of Old London and Paris of Old Paris, but that it is in fact
12+
quite unsafe, its sprawling body imperfectly embalmed and infested with queer
13+
animate things which have nothing to do with it as it was in compilation.
14+
15+
This book digs into all the awful details that are necessary to understand in
16+
order to write correct Unsafe Rust programs. Due to the nature of this problem,
17+
it may lead to unleashing untold horrors that shatter your psyche into a billion
18+
infinitesimal fragments of despair.
19+
20+
Should you wish a long and happy career of writing Rust programs, you should
21+
turn back now and forget you ever saw this book. It is not necessary. However
22+
if you intend to write unsafe code -- or just want to dig into the guts of the
23+
language -- this book contains invaluable information.
24+
25+
Unlike [The Book][trpl] we will be assuming considerable prior knowledge. In
26+
particular, you should be comfortable with basic systems programming and Rust.
27+
If you don't feel comfortable with these topics, you should consider [reading
28+
The Book][trpl] first. Though we will not be assuming that you have, and will
29+
take care to occasionally give a refresher on the basics where appropriate. You
30+
can skip straight to this book if you want; just know that we won't be
31+
explaining everything from the ground up.
32+
33+
To be clear, this book goes into deep detail. We're going to dig into
34+
exception-safety, pointer aliasing, memory models, and even some type-theory.
35+
We will also be spending a lot of time talking about the different kinds
36+
of safety and guarantees.
37+
38+
[trpl]: ../book/

branches/try/src/doc/tarpl/SUMMARY.md renamed to branches/try/src/doc/nomicon/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* [Ownership](ownership.md)
1111
* [References](references.md)
1212
* [Lifetimes](lifetimes.md)
13-
* [Limits of lifetimes](lifetime-mismatch.md)
13+
* [Limits of Lifetimes](lifetime-mismatch.md)
1414
* [Lifetime Elision](lifetime-elision.md)
1515
* [Unbounded Lifetimes](unbounded-lifetimes.md)
1616
* [Higher-Rank Trait Bounds](hrtb.md)

branches/try/src/doc/tarpl/atomics.md renamed to branches/try/src/doc/nomicon/atomics.md

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ face.
1717
The C11 memory model is fundamentally about trying to bridge the gap between the
1818
semantics we want, the optimizations compilers want, and the inconsistent chaos
1919
our hardware wants. *We* would like to just write programs and have them do
20-
exactly what we said but, you know, *fast*. Wouldn't that be great?
20+
exactly what we said but, you know, fast. Wouldn't that be great?
2121

2222

2323

@@ -35,20 +35,20 @@ y = 3;
3535
x = 2;
3636
```
3737

38-
The compiler may conclude that it would *really* be best if your program did
38+
The compiler may conclude that it would be best if your program did
3939

4040
```rust,ignore
4141
x = 2;
4242
y = 3;
4343
```
4444

45-
This has inverted the order of events *and* completely eliminated one event.
45+
This has inverted the order of events and completely eliminated one event.
4646
From a single-threaded perspective this is completely unobservable: after all
4747
the statements have executed we are in exactly the same state. But if our
48-
program is multi-threaded, we may have been relying on `x` to *actually* be
49-
assigned to 1 before `y` was assigned. We would *really* like the compiler to be
48+
program is multi-threaded, we may have been relying on `x` to actually be
49+
assigned to 1 before `y` was assigned. We would like the compiler to be
5050
able to make these kinds of optimizations, because they can seriously improve
51-
performance. On the other hand, we'd really like to be able to depend on our
51+
performance. On the other hand, we'd also like to be able to depend on our
5252
program *doing the thing we said*.
5353

5454

@@ -57,15 +57,15 @@ program *doing the thing we said*.
5757
# Hardware Reordering
5858

5959
On the other hand, even if the compiler totally understood what we wanted and
60-
respected our wishes, our *hardware* might instead get us in trouble. Trouble
60+
respected our wishes, our hardware might instead get us in trouble. Trouble
6161
comes from CPUs in the form of memory hierarchies. There is indeed a global
6262
shared memory space somewhere in your hardware, but from the perspective of each
6363
CPU core it is *so very far away* and *so very slow*. Each CPU would rather work
64-
with its local cache of the data and only go through all the *anguish* of
65-
talking to shared memory *only* when it doesn't actually have that memory in
64+
with its local cache of the data and only go through all the anguish of
65+
talking to shared memory only when it doesn't actually have that memory in
6666
cache.
6767

68-
After all, that's the whole *point* of the cache, right? If every read from the
68+
After all, that's the whole point of the cache, right? If every read from the
6969
cache had to run back to shared memory to double check that it hadn't changed,
7070
what would the point be? The end result is that the hardware doesn't guarantee
7171
that events that occur in the same order on *one* thread, occur in the same
@@ -99,13 +99,13 @@ provides weak ordering guarantees. This has two consequences for concurrent
9999
programming:
100100

101101
* Asking for stronger guarantees on strongly-ordered hardware may be cheap or
102-
even *free* because they already provide strong guarantees unconditionally.
102+
even free because they already provide strong guarantees unconditionally.
103103
Weaker guarantees may only yield performance wins on weakly-ordered hardware.
104104

105-
* Asking for guarantees that are *too* weak on strongly-ordered hardware is
105+
* Asking for guarantees that are too weak on strongly-ordered hardware is
106106
more likely to *happen* to work, even though your program is strictly
107-
incorrect. If possible, concurrent algorithms should be tested on weakly-
108-
ordered hardware.
107+
incorrect. If possible, concurrent algorithms should be tested on
108+
weakly-ordered hardware.
109109

110110

111111

@@ -115,10 +115,10 @@ programming:
115115

116116
The C11 memory model attempts to bridge the gap by allowing us to talk about the
117117
*causality* of our program. Generally, this is by establishing a *happens
118-
before* relationships between parts of the program and the threads that are
118+
before* relationship between parts of the program and the threads that are
119119
running them. This gives the hardware and compiler room to optimize the program
120120
more aggressively where a strict happens-before relationship isn't established,
121-
but forces them to be more careful where one *is* established. The way we
121+
but forces them to be more careful where one is established. The way we
122122
communicate these relationships are through *data accesses* and *atomic
123123
accesses*.
124124

@@ -130,8 +130,10 @@ propagate the changes made in data accesses to other threads as lazily and
130130
inconsistently as it wants. Mostly critically, data accesses are how data races
131131
happen. Data accesses are very friendly to the hardware and compiler, but as
132132
we've seen they offer *awful* semantics to try to write synchronized code with.
133-
Actually, that's too weak. *It is literally impossible to write correct
134-
synchronized code using only data accesses*.
133+
Actually, that's too weak.
134+
135+
**It is literally impossible to write correct synchronized code using only data
136+
accesses.**
135137

136138
Atomic accesses are how we tell the hardware and compiler that our program is
137139
multi-threaded. Each atomic access can be marked with an *ordering* that
@@ -141,7 +143,10 @@ they *can't* do. For the compiler, this largely revolves around re-ordering of
141143
instructions. For the hardware, this largely revolves around how writes are
142144
propagated to other threads. The set of orderings Rust exposes are:
143145

144-
* Sequentially Consistent (SeqCst) Release Acquire Relaxed
146+
* Sequentially Consistent (SeqCst)
147+
* Release
148+
* Acquire
149+
* Relaxed
145150

146151
(Note: We explicitly do not expose the C11 *consume* ordering)
147152

@@ -154,13 +159,13 @@ synchronize"
154159

155160
Sequentially Consistent is the most powerful of all, implying the restrictions
156161
of all other orderings. Intuitively, a sequentially consistent operation
157-
*cannot* be reordered: all accesses on one thread that happen before and after a
158-
SeqCst access *stay* before and after it. A data-race-free program that uses
162+
cannot be reordered: all accesses on one thread that happen before and after a
163+
SeqCst access stay before and after it. A data-race-free program that uses
159164
only sequentially consistent atomics and data accesses has the very nice
160165
property that there is a single global execution of the program's instructions
161166
that all threads agree on. This execution is also particularly nice to reason
162167
about: it's just an interleaving of each thread's individual executions. This
163-
*does not* hold if you start using the weaker atomic orderings.
168+
does not hold if you start using the weaker atomic orderings.
164169

165170
The relative developer-friendliness of sequential consistency doesn't come for
166171
free. Even on strongly-ordered platforms sequential consistency involves
@@ -170,8 +175,8 @@ In practice, sequential consistency is rarely necessary for program correctness.
170175
However sequential consistency is definitely the right choice if you're not
171176
confident about the other memory orders. Having your program run a bit slower
172177
than it needs to is certainly better than it running incorrectly! It's also
173-
*mechanically* trivial to downgrade atomic operations to have a weaker
174-
consistency later on. Just change `SeqCst` to e.g. `Relaxed` and you're done! Of
178+
mechanically trivial to downgrade atomic operations to have a weaker
179+
consistency later on. Just change `SeqCst` to `Relaxed` and you're done! Of
175180
course, proving that this transformation is *correct* is a whole other matter.
176181

177182

@@ -183,15 +188,15 @@ Acquire and Release are largely intended to be paired. Their names hint at their
183188
use case: they're perfectly suited for acquiring and releasing locks, and
184189
ensuring that critical sections don't overlap.
185190

186-
Intuitively, an acquire access ensures that every access after it *stays* after
191+
Intuitively, an acquire access ensures that every access after it stays after
187192
it. However operations that occur before an acquire are free to be reordered to
188193
occur after it. Similarly, a release access ensures that every access before it
189-
*stays* before it. However operations that occur after a release are free to be
194+
stays before it. However operations that occur after a release are free to be
190195
reordered to occur before it.
191196

192197
When thread A releases a location in memory and then thread B subsequently
193198
acquires *the same* location in memory, causality is established. Every write
194-
that happened *before* A's release will be observed by B *after* its release.
199+
that happened before A's release will be observed by B after its release.
195200
However no causality is established with any other threads. Similarly, no
196201
causality is established if A and B access *different* locations in memory.
197202

@@ -230,7 +235,7 @@ weakly-ordered platforms.
230235
# Relaxed
231236

232237
Relaxed accesses are the absolute weakest. They can be freely re-ordered and
233-
provide no happens-before relationship. Still, relaxed operations *are* still
238+
provide no happens-before relationship. Still, relaxed operations are still
234239
atomic. That is, they don't count as data accesses and any read-modify-write
235240
operations done to them occur atomically. Relaxed operations are appropriate for
236241
things that you definitely want to happen, but don't particularly otherwise care

0 commit comments

Comments
 (0)