Skip to content

Commit 3b399af

Browse files
committed
Merge pull request #2847 from ben0x539/incoming
Tiny documentation fixes in rust.md and src/libcore/task.rs
2 parents 547bf7c + 4ac7159 commit 3b399af

File tree

3 files changed

+29
-30
lines changed

3 files changed

+29
-30
lines changed

doc/rust.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -2871,12 +2871,12 @@ Consists of 2 statements, 3 expressions and 12 points:
28712871
* the point after evaluating the static initializer `"hello, world"`
28722872
* the point after the first statement
28732873
* the point before the second statement
2874-
* the point before evaluating the function value `print`
2875-
* the point after evaluating the function value `print`
2876-
* the point before evaluating the arguments to `print`
2874+
* the point before evaluating the function value `println`
2875+
* the point after evaluating the function value `println`
2876+
* the point before evaluating the arguments to `println`
28772877
* the point before evaluating the symbol `s`
28782878
* the point after evaluating the symbol `s`
2879-
* the point after evaluating the arguments to `print`
2879+
* the point after evaluating the arguments to `println`
28802880
* the point after the second statement
28812881

28822882

@@ -2894,9 +2894,9 @@ Consists of 1 statement, 7 expressions and 14 points:
28942894

28952895

28962896
* the point before the statement
2897-
* the point before evaluating the function value `print`
2898-
* the point after evaluating the function value `print`
2899-
* the point before evaluating the arguments to `print`
2897+
* the point before evaluating the function value `println`
2898+
* the point after evaluating the function value `println`
2899+
* the point before evaluating the arguments to `println`
29002900
* the point before evaluating the arguments to `+`
29012901
* the point before evaluating the function value `x`
29022902
* the point after evaluating the function value `x`
@@ -2907,7 +2907,7 @@ Consists of 1 statement, 7 expressions and 14 points:
29072907
* the point before evaluating the arguments to `y`
29082908
* the point after evaluating the arguments to `y`
29092909
* the point after evaluating the arguments to `+`
2910-
* the point after evaluating the arguments to `print`
2910+
* the point after evaluating the arguments to `println`
29112911

29122912

29132913
The typestate system reasons over points, rather than statements or
@@ -3186,7 +3186,7 @@ let x: ~int = ~10;
31863186
~~~~~~~~
31873187

31883188
Some operations (such as field selection) implicitly dereference boxes. An
3189-
example of an @dfn{implicit dereference} operation performed on box values:
3189+
example of an _implicit dereference_ operation performed on box values:
31903190

31913191
~~~~~~~~
31923192
let x = @{y: 10};
@@ -3196,8 +3196,8 @@ assert x.y == 10;
31963196
Other operations act on box values as single-word-sized address values. For
31973197
these operations, to access the value held in the box requires an explicit
31983198
dereference of the box value. Explicitly dereferencing a box is indicated with
3199-
the unary *star* operator `*`. Examples of such @dfn{explicit
3200-
dereference} operations are:
3199+
the unary *star* operator `*`. Examples of such _explicit dereference_
3200+
operations are:
32013201

32023202
* copying box values (`x = y`)
32033203
* passing box values to functions (`f(x,y)`)

src/libcore/comm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
* let po = comm::port();
1717
* let ch = comm::chan(po);
1818
*
19-
* task::spawn {||
19+
* do task::spawn {
2020
* comm::send(ch, "Hello, World");
21-
* });
21+
* }
2222
*
2323
* io::println(comm::recv(p));
2424
* ~~~

src/libcore/task.rs

+16-17
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* # Example
1818
*
1919
* ~~~
20-
* spawn {||
20+
* do spawn {
2121
* log(error, "Hello, World!");
2222
* }
2323
* ~~~
@@ -350,7 +350,6 @@ fn run_with<A:send>(-builder: builder,
350350
+f: fn~(+A)) {
351351

352352
/*!
353-
*
354353
* Runs a task, while transfering ownership of one argument to the
355354
* child.
356355
*
@@ -412,15 +411,13 @@ fn spawn(+f: fn~()) {
412411

413412
fn spawn_with<A:send>(+arg: A, +f: fn~(+A)) {
414413
/*!
415-
* Runs a new task while providing a channel from the parent to the child
414+
* Runs a task, while transfering ownership of one argument to the
415+
* child.
416416
*
417-
* Sets up a communication channel from the current task to the new
418-
* child task, passes the port to child's body, and returns a channel
419-
* linked to the port to the parent.
417+
* This is useful for transfering ownership of noncopyables to
418+
* another task.
420419
*
421-
* This encapsulates some boilerplate handshaking logic that would
422-
* otherwise be required to establish communication from the parent
423-
* to the child.
420+
* This function is equivalent to `run_with(builder(), arg, f)`.
424421
*/
425422

426423
run_with(builder(), arg, f)
@@ -443,7 +440,7 @@ fn spawn_listener<A:send>(+f: fn~(comm::port<A>)) -> comm::chan<A> {
443440
*
444441
* let po = comm::port();
445442
* let ch = comm::chan(po);
446-
* let ch = spawn_listener {|po|
443+
* let ch = do spawn_listener |po| {
447444
* // Now the child has a port called 'po' to read from and
448445
* // an environment-captured channel called 'ch'.
449446
* };
@@ -537,13 +534,15 @@ fn get_task() -> task {
537534
*
538535
* # Example
539536
*
540-
* task::unkillable {||
541-
* // detach / yield / destroy must all be called together
542-
* rustrt::rust_port_detach(po);
543-
* // This must not result in the current task being killed
544-
* task::yield();
545-
* rustrt::rust_port_destroy(po);
546-
* }
537+
* ~~~
538+
* do task::unkillable {
539+
* // detach / yield / destroy must all be called together
540+
* rustrt::rust_port_detach(po);
541+
* // This must not result in the current task being killed
542+
* task::yield();
543+
* rustrt::rust_port_destroy(po);
544+
* }
545+
* ~~~
547546
*/
548547
unsafe fn unkillable(f: fn()) {
549548
class allow_failure {

0 commit comments

Comments
 (0)