Skip to content

Rollup of 10 pull requests #25281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 120 commits into from
May 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
a8ea78b
configure: generic run command
richo Apr 27, 2015
b982a75
configure: Disable valgrind-rpass if there's no valgrind
richo Apr 27, 2015
fc7faaf
configure: Fail iff valgrind is explicitly requested but not available
richo Apr 28, 2015
a4c1337
link to .editorconfig for Rust files
derhuerst Apr 29, 2015
6f3641d
distinction between official and community plugins
derhuerst Apr 29, 2015
dff7676
Fix MIPS build errors in libstd/os/linux/raw.rs
kevinmehall May 5, 2015
6c6b200
Add TCP_* constants for mips/mipsel Linux
kevinmehall May 5, 2015
c82da7a
core: added core::num::flt2dec for floating-point formatting.
lifthrasiir Apr 19, 2015
5aa9f38
core: made the core formatter to use a new flt2dec.
lifthrasiir Apr 19, 2015
f9bfda0
core: tweaked flt2dec to match the casing of the older formatting code.
lifthrasiir Apr 21, 2015
85424c4
test: update tests for flt2dec fallouts.
lifthrasiir Apr 19, 2015
8a195f0
core: fixed typos and revised comments in flt2dec.
lifthrasiir Apr 20, 2015
97ea7c1
core: fixed a slight bug.
lifthrasiir Apr 21, 2015
a641b05
core: updated for the master changes.
lifthrasiir Apr 23, 2015
3d34e17
core: use banker's rounding for the exact mode in flt2dec.
lifthrasiir May 6, 2015
48636f3
Add missing inline attribute to Not impl for Wrapping<T>
inrustwetrust May 6, 2015
7150d3c
Change rand version to '*'
bengesoff May 7, 2015
0bc6fe5
Refactor to keep rand version 0.3.0
bengesoff May 7, 2015
0749991
Fix incorrect curly quotes
steveklabnik May 7, 2015
888086d
Undid changes involving misunderstanding of 0.3.x
bengesoff May 7, 2015
11cb5e5
Add long diagnostic for E0046
May 7, 2015
4d1e48e
Typo in ownership.md
tincann May 7, 2015
ae1b2f4
Another typo
tincann May 7, 2015
11a7bad
Add long diagnostic for E0054
May 7, 2015
7ef46e0
doc: the prevailing convention is to use assert_eq! when 2 values are…
tshepang May 7, 2015
2213898
two minor fixes
simonkern May 7, 2015
84c7dfa
deleted unnecessary `the`
simonkern May 7, 2015
468cb05
Expand OS X versions referenced in configure message
carols10cents May 7, 2015
3e76f28
v2 gets a copy of the pointer, not a copy of the data
simonkern May 7, 2015
60c0e75
fixed href for structs
simonkern May 7, 2015
391d148
fix logic when describing kinds of borrows
astraw Apr 27, 2015
c65a183
Fix sort in AUTHORS.txt
sharnik May 8, 2015
a4ec372
fixed a mistake
rick68 May 8, 2015
ee06263
Fallout from fixing Issue 25199.
pnkfelix May 8, 2015
b5b5a17
dropck: must assume `Box<Trait + 'a>` has a destructor of interest.
pnkfelix May 8, 2015
091ba42
Add a reason to the libc & rand instability.
huonw May 8, 2015
ccf1285
Regression tests for Issue 25199 (dropck and `Box<Trait + 'a>`).
pnkfelix May 8, 2015
d8d4bb4
fallout to run-pass tests.
pnkfelix May 8, 2015
0fa1c16
Fallout to compile-fail tests.
pnkfelix May 8, 2015
544362c
Update method-syntax.md
acgtyrant May 8, 2015
962816b
Update method-syntax.md
acgtyrant May 8, 2015
00204e8
mk: Add a missing folder to the dist directory
alexcrichton May 8, 2015
ff332b6
Squeeze the last bits of `task`s in documentation in favor of `thread`
barosl May 8, 2015
1e1e6e0
Fix invalid references due to the automated string substitution
barosl May 8, 2015
857b70f
Please the `make tidy`
barosl May 8, 2015
01fc026
mk: Log that valgrind tests are disabled
richo May 8, 2015
9b91ccf
Fix the tests broken by replacing `task` with `thread`
barosl May 8, 2015
8b8cb34
Rollup merge of #24864 - astraw:patch-1, r=steveklabnik
Manishearth May 8, 2015
4c0f7fd
Rollup merge of #25140 - kevinmehall:mips, r=steveklabnik
Manishearth May 8, 2015
61c1cf7
Rollup merge of #25179 - bengesoff:patch-1, r=steveklabnik
Manishearth May 8, 2015
b022709
Rollup merge of #25181 - steveklabnik:fix_curlies, r=alexcrichton
Manishearth May 8, 2015
638deb3
Rollup merge of #25190 - nham:E0046_E0054, r=alexcrichton
Manishearth May 8, 2015
6550420
Rollup merge of #25194 - tshepang:assert-convention, r=steveklabnik
Manishearth May 8, 2015
4b4cb86
Rollup merge of #25195 - simonkern:master, r=steveklabnik
Manishearth May 8, 2015
f7980a3
Rollup merge of #25198 - carols10cents:update-configure-osx, r=alexcr…
Manishearth May 8, 2015
8a6bb9f
Rollup merge of #25203 - sharnik:fix-sort-authors, r=alexcrichton
Manishearth May 8, 2015
a3a3d4e
Rollup merge of #25210 - rick68:patch-1, r=alexcrichton
Manishearth May 8, 2015
dd37250
Rollup merge of #25211 - huonw:libc, r=cmr
Manishearth May 8, 2015
55437b4
Rollup merge of #25215 - acgtyrant:patch-2, r=alexcrichton
Manishearth May 8, 2015
b210aea
Auto merge of #25218 - Manishearth:rollup, r=Manishearth
bors May 8, 2015
d3958c6
Auto merge of #25217 - alexcrichton:fix-distcheck, r=brson
bors May 8, 2015
a29dc05
Document panic behaviour of BitVec::split_off
jooert May 8, 2015
aaa3641
core: impl AsRef<[u8]> for str
seanmonstar May 6, 2015
093ebd5
collections: impl AsRef<[u8]> for String
seanmonstar May 6, 2015
8e491ef
collections: change bounds of SliceConcatExt implementations to use B…
seanmonstar May 9, 2015
c033d98
Auto merge of #25162 - seanmonstar:asref-bytes, r=alexcrichton
bors May 9, 2015
bf06163
Remove references to deprecated `extern crate "foo" as bar` syntax
carols10cents May 9, 2015
8c9dc18
Auto merge of #24859 - richo:valgrind-tests, r=brson
bors May 9, 2015
50aada7
Auto merge of #25159 - inrustwetrust:wrapping_inline, r=alexcrichton
bors May 9, 2015
7129b25
Auto merge of #25231 - carols10cents:lingering-quoted-crate-names, r=…
bors May 9, 2015
8654dfb
address fallout in libsyntaxtest.
pnkfelix May 9, 2015
95400c5
Auto merge of #25214 - acgtyrant:patch-1, r=brson
bors May 9, 2015
3906edf
Auto merge of #25212 - pnkfelix:dropck-box-trait, r=nikomatsakis
bors May 9, 2015
7a91fe8
Fixed a typo. Removed an extra s
sindreij May 9, 2015
1e9ce0d
std: Add example for HashMap::entry()
May 9, 2015
7a2ac0c
Added start of last text block
sindreij May 9, 2015
ac478ec
Rollup merge of #25216 - barosl:no-more-task, r=Manishearth
Manishearth May 9, 2015
511a8d4
Rollup merge of #25227 - jooert:bitvec-doc-fix, r=alexcrichton
Manishearth May 9, 2015
4979423
Auto merge of #25243 - Manishearth:rollup, r=Manishearth
bors May 9, 2015
1aecd17
test: fixed some tests affected by banker's rounding.
lifthrasiir May 9, 2015
67ba6dc
Auto merge of #24612 - lifthrasiir:flt2dec, r=pnkfelix
bors May 9, 2015
30f88c8
Use of @pnkfelix code and fix typos
GuillaumeGomez May 9, 2015
dc630d0
Auto merge of #24728 - GuillaumeGomez:type-mismatch, r=pnkfelix
bors May 9, 2015
14d476e
Remove auxiliary files not used since 812637e
carols10cents May 9, 2015
7d5c248
Remove auxiliary file not used since 17da4c7
carols10cents May 9, 2015
757809c
Remove auxiliary files not used since eb4d39e
carols10cents May 9, 2015
978dc9f
Minor docs fix
robyoung May 9, 2015
87f0237
Add long diagnostics for E0062 and E0063
May 7, 2015
f736468
Add long diagnostic for E0137
May 8, 2015
df64e05
Change E0062 and E0063 to say each field should be specified once.
May 8, 2015
a1898f8
Convert #[lang="..."] to #[lang = "..."]
May 9, 2015
7984074
Convert #[lang=".."] to #[lang = ".."] for docs too.
May 9, 2015
8e8f8d9
Upgraded warning for invalid crate_type attribute syntax to an error
inrustwetrust May 9, 2015
fa3fd81
Update error-handling.md
acgtyrant May 9, 2015
f8888af
Add omitted word to mutability docs.
dpetersen May 10, 2015
788d762
Remove obsolete comment in rustc::middle::subst.
May 10, 2015
ae1b64f
Fix typo in Match document.
dpetersen May 10, 2015
15c9f44
Rollup merge of #25200 - nham:E0062_E0063, r=alexcrichton
Manishearth May 10, 2015
79ca74d
Rollup merge of #25242 - acgtyrant:patch-3, r=Manishearth
Manishearth May 10, 2015
f23867a
Rollup merge of #25248 - carols10cents:unused-auxiliaries, r=Manishearth
Manishearth May 10, 2015
fd099b2
Rollup merge of #25249 - robyoung:minor-doc-fix, r=Manishearth
Manishearth May 10, 2015
459652c
Rollup merge of #25251 - nham:whitespace_lang_items, r=Manishearth
Manishearth May 10, 2015
87a6278
Rollup merge of #25252 - inrustwetrust:crate-type-attribute, r=alexcr…
Manishearth May 10, 2015
2274bf1
Rollup merge of #25261 - nham:obsolete_assoc_space_comment, r=alexcri…
Manishearth May 10, 2015
750f2c6
Auto merge of #25262 - Manishearth:rollup, r=Manishearth
bors May 10, 2015
2cc4d82
Fix small typos in documentation
fhinkel May 10, 2015
8ad1c90
Removed the backticks on slices
sindreij May 10, 2015
a168dba
Add #[inline] to AsRef<str>::as_ref for String and str.
koute May 10, 2015
5613502
Add long diagnostic for E0067
caipre May 10, 2015
ffc0d04
Add long diagnostic for E0131, E0132
caipre May 10, 2015
371eb87
Rollup merge of #24948 - derhuerst:patch-1, r=steveklabnik
steveklabnik May 10, 2015
ad1c0c5
Rollup merge of #25158 - koute:master, r=alexcrichton
steveklabnik May 10, 2015
a725378
Rollup merge of #25188 - tincann:patch-1, r=steveklabnik
steveklabnik May 10, 2015
ba8eb58
Rollup merge of #25222 - GuillaumeGomez:doc-ref, r=steveklabnik
steveklabnik May 10, 2015
fa207fa
Rollup merge of #25239 - sindreij:patch-1, r=alexcrichton
steveklabnik May 10, 2015
dcc76da
Rollup merge of #25240 - bluss:doc-hashmap-entry, r=steveklabnik
steveklabnik May 10, 2015
d065d57
Rollup merge of #25241 - sindreij:patch-2, r=steveklabnik
steveklabnik May 10, 2015
5160bf8
Rollup merge of #25255 - caipre:diagnostic-messages, r=alexcrichton
steveklabnik May 10, 2015
7ae332c
Rollup merge of #25257 - dpetersen:mutability-docfix, r=steveklabnik
steveklabnik May 10, 2015
c70458b
Rollup merge of #25263 - fhinkel:master, r=steveklabnik
steveklabnik May 10, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ Luke Francl <[email protected]>
Luke Metz <[email protected]>
Luke Steensen <[email protected]>
Luqman Aden <[email protected]>
Łukasz Niemier <[email protected]>
Magnus Auvinen <[email protected]>
Mahmut Bulut <[email protected]>
Makoto Nakashima <[email protected]>
Expand Down Expand Up @@ -997,5 +998,4 @@ xales <[email protected]>
zofrex <[email protected]>
zslayton <[email protected]>
zzmp <[email protected]>
Łukasz Niemier <[email protected]>
克雷 <[email protected]>
30 changes: 23 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ err() {
exit 1
}

run() {
msg "$@"
"$@"
}

need_ok() {
if [ $? -ne 0 ]
then
Expand All @@ -36,8 +41,7 @@ need_cmd() {
make_dir() {
if [ ! -d $1 ]
then
msg "mkdir -p $1"
mkdir -p $1
run mkdir -p $1
fi
}

Expand All @@ -46,8 +50,7 @@ copy_if_changed() {
then
msg "leaving $2 unchanged"
else
msg "cp $1 $2"
cp -f $1 $2
run cp -f $1 $2
chmod u-w $2 # make copied artifact read-only
fi
}
Expand All @@ -57,8 +60,7 @@ move_if_changed() {
then
msg "leaving $2 unchanged"
else
msg "mv $1 $2"
mv -f $1 $2
run mv -f $1 $2
chmod u-w $2 # make moved artifact read-only
fi
}
Expand Down Expand Up @@ -733,6 +735,20 @@ then
probe CFG_JAVAC javac
fi

# the valgrind rpass tests will fail if you don't have a valgrind, but they're
# only disabled if you opt out.
if [ -z "$CFG_VALGRIND" ]
then
# If the user has explicitly asked for valgrind tests, then fail
if [ -n "$CFG_ENABLE_VALGRIND" ] && [ -n "$CFG_ENABLE_VALGRIND_PROVIDED" ]
then
err "No valgrind present, but valgrind tests explicitly requested"
else
CFG_DISABLE_VALGRIND_RPASS=1
putvar CFG_DISABLE_VALGRIND_RPASS
fi
fi

if [ ! -z "$CFG_GDB" ]
then
# Store GDB's version
Expand Down Expand Up @@ -844,7 +860,7 @@ then
CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version")
if [ $? -eq 0 ]
then
step_msg "on OS X 10.9, forcing use of clang"
step_msg "on OS X >=10.9, forcing use of clang"
CFG_ENABLE_CLANG=1
else
if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then
Expand Down
1 change: 1 addition & 0 deletions mk/dist.mk
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ PKG_FILES := \
doc \
driver \
etc \
error-index-generator \
$(foreach crate,$(CRATES),lib$(crate)) \
libcollectionstest \
libcoretest \
Expand Down
1 change: 1 addition & 0 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ ifndef CFG_DISABLE_VALGRIND_RPASS
$(info cfg: valgrind-rpass command set to $(CFG_VALGRIND))
CFG_VALGRIND_RPASS :=$(CFG_VALGRIND)
else
$(info cfg: disabling valgrind run-pass tests)
CFG_VALGRIND_RPASS :=
endif

Expand Down
4 changes: 2 additions & 2 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ pub fn run_tests(config: &Config) {
}

// android debug-info test uses remote debugger
// so, we test 1 task at once.
// so, we test 1 thread at once.
// also trying to isolate problems with adb_run_wrapper.sh ilooping
env::set_var("RUST_TEST_THREADS","1");
}

match config.mode {
DebugInfoLldb => {
// Some older versions of LLDB seem to have problems with multiple
// instances running in parallel, so only run one test task at a
// instances running in parallel, so only run one test thread at a
// time.
env::set_var("RUST_TEST_THREADS", "1");
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/complement-design-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ code should need to run is a stack.
possibility is covered by the `match`, adding further variants to the `enum`
in the future will prompt a compilation failure, rather than runtime panic.
Second, it makes cost explicit. In general, the only safe way to have a
non-exhaustive match would be to panic the task if nothing is matched, though
non-exhaustive match would be to panic the thread if nothing is matched, though
it could fall through if the type of the `match` expression is `()`. This sort
of hidden cost and special casing is against the language's philosophy. It's
easy to ignore certain cases by using the `_` wildcard:
Expand Down
12 changes: 6 additions & 6 deletions src/doc/complement-lang-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ Data values in the language can only be constructed through a fixed set of initi
* There is no global inter-crate namespace; all name management occurs within a crate.
* Using another crate binds the root of _its_ namespace into the user's namespace.

## Why is panic unwinding non-recoverable within a task? Why not try to "catch exceptions"?
## Why is panic unwinding non-recoverable within a thread? Why not try to "catch exceptions"?

In short, because too few guarantees could be made about the dynamic environment of the catch block, as well as invariants holding in the unwound heap, to be able to safely resume; we believe that other methods of signalling and logging errors are more appropriate, with tasks playing the role of a "hard" isolation boundary between separate heaps.
In short, because too few guarantees could be made about the dynamic environment of the catch block, as well as invariants holding in the unwound heap, to be able to safely resume; we believe that other methods of signalling and logging errors are more appropriate, with threads playing the role of a "hard" isolation boundary between separate heaps.

Rust provides, instead, three predictable and well-defined options for handling any combination of the three main categories of "catch" logic:

* Failure _logging_ is done by the integrated logging subsystem.
* _Recovery_ after a panic is done by trapping a task panic from _outside_
the task, where other tasks are known to be unaffected.
* _Recovery_ after a panic is done by trapping a thread panic from _outside_
the thread, where other threads are known to be unaffected.
* _Cleanup_ of resources is done by RAII-style objects with destructors.

Cleanup through RAII-style destructors is more likely to work than in catch blocks anyways, since it will be better tested (part of the non-error control paths, so executed all the time).
Expand All @@ -91,8 +91,8 @@ We don't know if there's an obvious, easy, efficient, stock-textbook way of supp

There's a lot of debate on this topic; it's easy to find a proponent of default-sync or default-async communication, and there are good reasons for either. Our choice rests on the following arguments:

* Part of the point of isolating tasks is to decouple tasks from one another, such that assumptions in one task do not cause undue constraints (or bugs, if violated!) in another. Temporal coupling is as real as any other kind; async-by-default relaxes the default case to only _causal_ coupling.
* Default-async supports buffering and batching communication, reducing the frequency and severity of task-switching and inter-task / inter-domain synchronization.
* Part of the point of isolating threads is to decouple threads from one another, such that assumptions in one thread do not cause undue constraints (or bugs, if violated!) in another. Temporal coupling is as real as any other kind; async-by-default relaxes the default case to only _causal_ coupling.
* Default-async supports buffering and batching communication, reducing the frequency and severity of thread-switching and inter-thread / inter-domain synchronization.
* Default-async with transmittable channels is the lowest-level building block on which more-complex synchronization topologies and strategies can be built; it is not clear to us that the majority of cases fit the 2-party full-synchronization pattern rather than some more complex multi-party or multi-stage scenario. We did not want to force all programs to pay for wiring the former assumption into all communications.

## Why are channels half-duplex (one-way)?
Expand Down
8 changes: 4 additions & 4 deletions src/doc/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ view_item : extern_crate_decl | use_decl ;

```antlr
extern_crate_decl : "extern" "crate" crate_name
crate_name: ident | ( string_lit as ident )
crate_name: ident | ( ident "as" ident )
```

##### Use declarations
Expand Down Expand Up @@ -789,8 +789,8 @@ bound := path | lifetime

### Boxes

## Tasks
## Threads

### Communication between tasks
### Communication between threads

### Task lifecycle
### Thread lifecycle
13 changes: 6 additions & 7 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,10 @@ provided in the `extern_crate_decl`.
The external crate is resolved to a specific `soname` at compile time, and a
runtime linkage requirement to that `soname` is passed to the linker for
loading at runtime. The `soname` is resolved at compile time by scanning the
compiler's library path and matching the optional `crateid` provided as a
string literal against the `crateid` attributes that were declared on the
external crate when it was compiled. If no `crateid` is provided, a default
`name` attribute is assumed, equal to the `ident` given in the
`extern_crate_decl`.
compiler's library path and matching the optional `crateid` provided against
the `crateid` attributes that were declared on the external crate when it was
compiled. If no `crateid` is provided, a default `name` attribute is assumed,
equal to the `ident` given in the `extern_crate_decl`.

Three examples of `extern crate` declarations:

Expand Down Expand Up @@ -2029,7 +2028,7 @@ makes it possible to declare these operations. For example, the `str` module
in the Rust standard library defines the string equality function:

```{.ignore}
#[lang="str_eq"]
#[lang = "str_eq"]
pub fn eq_slice(a: &str, b: &str) -> bool {
// details elided
}
Expand Down Expand Up @@ -3636,7 +3635,7 @@ that have since been removed):
* ML Kit, Cyclone: region based memory management
* Haskell (GHC): typeclasses, type families
* Newsqueak, Alef, Limbo: channels, concurrency
* Erlang: message passing, task failure, ~~linked task failure~~,
* Erlang: message passing, thread failure, ~~linked thread failure~~,
~~lightweight concurrency~~
* Swift: optional bindings
* Scheme: hygienic macros
Expand Down
4 changes: 2 additions & 2 deletions src/doc/style/errors/handling.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% Handling errors

### Use task isolation to cope with failure. [FIXME]
### Use thread isolation to cope with failure. [FIXME]

> **[FIXME]** Explain how to isolate tasks and detect task failure for recovery.
> **[FIXME]** Explain how to isolate threads and detect thread failure for recovery.

### Consuming `Result` [FIXME]
8 changes: 4 additions & 4 deletions src/doc/style/errors/signaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Errors fall into one of three categories:
The basic principle of the convention is that:

* Catastrophic errors and programming errors (bugs) can and should only be
recovered at a *coarse grain*, i.e. a task boundary.
recovered at a *coarse grain*, i.e. a thread boundary.
* Obstructions preventing an operation should be reported at a maximally *fine
grain* -- to the immediate invoker of the operation.

## Catastrophic errors

An error is _catastrophic_ if there is no meaningful way for the current task to
An error is _catastrophic_ if there is no meaningful way for the current thread to
continue after the error occurs.

Catastrophic errors are _extremely_ rare, especially outside of `libstd`.
Expand All @@ -28,7 +28,7 @@ Catastrophic errors are _extremely_ rare, especially outside of `libstd`.

For errors like stack overflow, Rust currently aborts the process, but
could in principle panic, which (in the best case) would allow
reporting and recovery from a supervisory task.
reporting and recovery from a supervisory thread.

## Contract violations

Expand All @@ -44,7 +44,7 @@ existing borrows have been relinquished.

A contract violation is always a bug, and for bugs we follow the Erlang
philosophy of "let it crash": we assume that software *will* have bugs, and we
design coarse-grained task boundaries to report, and perhaps recover, from these
design coarse-grained thread boundaries to report, and perhaps recover, from these
bugs.

### Contract design
Expand Down
28 changes: 14 additions & 14 deletions src/doc/style/ownership/builders.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If `T` is such a data structure, consider introducing a `T` _builder_:
4. The builder should provide one or more "_terminal_" methods for actually building a `T`.

The builder pattern is especially appropriate when building a `T` involves side
effects, such as spawning a task or launching a process.
effects, such as spawning a thread or launching a process.

In Rust, there are two variants of the builder pattern, differing in the
treatment of ownership, as described below.
Expand Down Expand Up @@ -115,24 +115,24 @@ Sometimes builders must transfer ownership when constructing the final type
`T`, meaning that the terminal methods must take `self` rather than `&self`:

```rust
// A simplified excerpt from std::task::TaskBuilder
// A simplified excerpt from std::thread::Builder

impl TaskBuilder {
/// Name the task-to-be. Currently the name is used for identification
impl ThreadBuilder {
/// Name the thread-to-be. Currently the name is used for identification
/// only in failure messages.
pub fn named(mut self, name: String) -> TaskBuilder {
pub fn named(mut self, name: String) -> ThreadBuilder {
self.name = Some(name);
self
}

/// Redirect task-local stdout.
pub fn stdout(mut self, stdout: Box<Writer + Send>) -> TaskBuilder {
/// Redirect thread-local stdout.
pub fn stdout(mut self, stdout: Box<Writer + Send>) -> ThreadBuilder {
self.stdout = Some(stdout);
// ^~~~~~ this is owned and cannot be cloned/re-used
self
}

/// Creates and executes a new child task.
/// Creates and executes a new child thread.
pub fn spawn(self, f: proc():Send) {
// consume self
...
Expand All @@ -141,7 +141,7 @@ impl TaskBuilder {
```

Here, the `stdout` configuration involves passing ownership of a `Writer`,
which must be transferred to the task upon construction (in `spawn`).
which must be transferred to the thread upon construction (in `spawn`).

When the terminal methods of the builder require ownership, there is a basic tradeoff:

Expand All @@ -158,17 +158,17 @@ builder methods for a consuming builder should take and returned an owned

```rust
// One-liners
TaskBuilder::new().named("my_task").spawn(proc() { ... });
ThreadBuilder::new().named("my_thread").spawn(proc() { ... });

// Complex configuration
let mut task = TaskBuilder::new();
task = task.named("my_task_2"); // must re-assign to retain ownership
let mut thread = ThreadBuilder::new();
thread = thread.named("my_thread_2"); // must re-assign to retain ownership

if reroute {
task = task.stdout(mywriter);
thread = thread.stdout(mywriter);
}

task.spawn(proc() { ... });
thread.spawn(proc() { ... });
```

One-liners work as before, because ownership is threaded through each of the
Expand Down
2 changes: 1 addition & 1 deletion src/doc/style/ownership/destructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go out of scope.

### Destructors should not fail. [FIXME: needs RFC]

Destructors are executed on task failure, and in that context a failing
Destructors are executed on thread failure, and in that context a failing
destructor causes the program to abort.

Instead of failing in a destructor, provide a separate method for checking for
Expand Down
8 changes: 4 additions & 4 deletions src/doc/style/style/comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
Use line comments:

``` rust
// Wait for the main task to return, and set the process error code
// Wait for the main thread to return, and set the process error code
// appropriately.
```

Instead of:

``` rust
/*
* Wait for the main task to return, and set the process error code
* Wait for the main thread to return, and set the process error code
* appropriately.
*/
```
Expand Down Expand Up @@ -55,7 +55,7 @@ For example:
/// Sets up a default runtime configuration, given compiler-supplied arguments.
///
/// This function will block until the entire pool of M:N schedulers has
/// exited. This function also requires a local task to be available.
/// exited. This function also requires a local thread to be available.
///
/// # Arguments
///
Expand All @@ -64,7 +64,7 @@ For example:
/// * `main` - The initial procedure to run inside of the M:N scheduling pool.
/// Once this procedure exits, the scheduling pool will begin to shut
/// down. The entire pool (and this function) will only return once
/// all child tasks have finished executing.
/// all child threads have finished executing.
///
/// # Return value
///
Expand Down
2 changes: 1 addition & 1 deletion src/doc/style/style/naming/containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ they enclose. Accessor methods often have variants to access the data
by value, by reference, and by mutable reference.

In general, the `get` family of methods is used to access contained
data without any risk of task failure; they return `Option` as
data without any risk of thread failure; they return `Option` as
appropriate. This name is chosen rather than names like `find` or
`lookup` because it is appropriate for a wider range of container types.

Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and more cores, yet many programmers aren't prepared to fully utilize them.

Rust's memory safety features also apply to its concurrency story too. Even
concurrent Rust programs must be memory safe, having no data races. Rust's type
system is up to the task, and gives you powerful ways to reason about
system is up to the thread, and gives you powerful ways to reason about
concurrent code at compile time.

Before we talk about the concurrency features that come with Rust, it's important
Expand Down
Loading