From 97a76b8eec8a7538b97f5ee6fdb80b8cbdbed0e9 Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Mon, 9 Jul 2012 04:16:04 +0200 Subject: [PATCH 1/6] core: Remove spurious newline in task::run_with documentation --- src/libcore/task.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libcore/task.rs b/src/libcore/task.rs index f41e24c623f70..c1030bc730a5d 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -344,7 +344,6 @@ fn run_with(-builder: builder, +f: fn~(+A)) { /*! - * * Runs a task, while transfering ownership of one argument to the * child. * From cf4d5f4e4c4b1f853e2491be6c9440c2920e640d Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Mon, 9 Jul 2012 04:05:48 +0200 Subject: [PATCH 2/6] core: Give task::spawn_with the documentation from task::run_with --- src/libcore/task.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libcore/task.rs b/src/libcore/task.rs index c1030bc730a5d..abba0c6d7f7b6 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -405,15 +405,13 @@ fn spawn(+f: fn~()) { fn spawn_with(+arg: A, +f: fn~(+A)) { /*! - * Runs a new task while providing a channel from the parent to the child + * Runs a task, while transfering ownership of one argument to the + * child. * - * Sets up a communication channel from the current task to the new - * child task, passes the port to child's body, and returns a channel - * linked to the port to the parent. + * This is useful for transfering ownership of noncopyables to + * another task. * - * This encapsulates some boilerplate handshaking logic that would - * otherwise be required to establish communication from the parent - * to the child. + * This function is equivalent to `run_with(builder(), arg, f)`. */ run_with(builder(), arg, f) From abd0de5d5c0dfd3a270192dc7099cfe2b289f6ee Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Mon, 9 Jul 2012 04:19:38 +0200 Subject: [PATCH 3/6] docs: In rust.md, replace inert @dfn{foo} formatting with _foo_ --- doc/rust.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/rust.md b/doc/rust.md index f002393b71ace..dd419911e818a 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -3186,7 +3186,7 @@ let x: ~int = ~10; ~~~~~~~~ Some operations (such as field selection) implicitly dereference boxes. An -example of an @dfn{implicit dereference} operation performed on box values: +example of an _implicit dereference_ operation performed on box values: ~~~~~~~~ let x = @{y: 10}; @@ -3196,8 +3196,8 @@ assert x.y == 10; Other operations act on box values as single-word-sized address values. For these operations, to access the value held in the box requires an explicit dereference of the box value. Explicitly dereferencing a box is indicated with -the unary *star* operator `*`. Examples of such @dfn{explicit -dereference} operations are: +the unary *star* operator `*`. Examples of such _explicit dereference_ +operations are: * copying box values (`x = y`) * passing box values to functions (`f(x,y)`) From 2dae18234d7ce824d69829edddd5c30ee1fb54b8 Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Mon, 9 Jul 2012 04:24:21 +0200 Subject: [PATCH 4/6] docs: In rust.md, replace 'print' with 'println' to match points example --- doc/rust.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/rust.md b/doc/rust.md index dd419911e818a..e41f1447201ef 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -2871,12 +2871,12 @@ Consists of 2 statements, 3 expressions and 12 points: * the point after evaluating the static initializer `"hello, world"` * the point after the first statement * the point before the second statement -* the point before evaluating the function value `print` -* the point after evaluating the function value `print` -* the point before evaluating the arguments to `print` +* the point before evaluating the function value `println` +* the point after evaluating the function value `println` +* the point before evaluating the arguments to `println` * the point before evaluating the symbol `s` * the point after evaluating the symbol `s` -* the point after evaluating the arguments to `print` +* the point after evaluating the arguments to `println` * the point after the second statement @@ -2894,9 +2894,9 @@ Consists of 1 statement, 7 expressions and 14 points: * the point before the statement -* the point before evaluating the function value `print` -* the point after evaluating the function value `print` -* the point before evaluating the arguments to `print` +* the point before evaluating the function value `println` +* the point after evaluating the function value `println` +* the point before evaluating the arguments to `println` * the point before evaluating the arguments to `+` * the point before evaluating the function value `x` * the point after evaluating the function value `x` @@ -2907,7 +2907,7 @@ Consists of 1 statement, 7 expressions and 14 points: * the point before evaluating the arguments to `y` * the point after evaluating the arguments to `y` * the point after evaluating the arguments to `+` -* the point after evaluating the arguments to `print` +* the point after evaluating the arguments to `println` The typestate system reasons over points, rather than statements or From b91358458b34705b0a0f5f9de5b1e543c84f3de8 Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Mon, 9 Jul 2012 04:06:54 +0200 Subject: [PATCH 5/6] core: Formatting fix in documentation for task::unkillable --- src/libcore/task.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/libcore/task.rs b/src/libcore/task.rs index abba0c6d7f7b6..6b871afa57d71 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -528,13 +528,15 @@ fn get_task() -> task { * * # Example * - * task::unkillable {|| - * // detach / yield / destroy must all be called together - * rustrt::rust_port_detach(po); - * // This must not result in the current task being killed - * task::yield(); - * rustrt::rust_port_destroy(po); - * } + * ~~~ + * task::unkillable {|| + * // detach / yield / destroy must all be called together + * rustrt::rust_port_detach(po); + * // This must not result in the current task being killed + * task::yield(); + * rustrt::rust_port_destroy(po); + * } + * ~~~ */ unsafe fn unkillable(f: fn()) { class allow_failure { From 4ac7159536fd06c83e58ac5331bae21f800e0583 Mon Sep 17 00:00:00 2001 From: Benjamin Herr Date: Mon, 9 Jul 2012 13:46:32 +0200 Subject: [PATCH 6/6] core: New closure syntax for comm.rs/task.rs docs --- src/libcore/comm.rs | 4 ++-- src/libcore/task.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index 7276bea5b1c04..9a50f4758f076 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -16,9 +16,9 @@ * let po = comm::port(); * let ch = comm::chan(po); * - * task::spawn {|| + * do task::spawn { * comm::send(ch, "Hello, World"); - * }); + * } * * io::println(comm::recv(p)); * ~~~ diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 6b871afa57d71..8cdcdb94bf8a0 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -17,7 +17,7 @@ * # Example * * ~~~ - * spawn {|| + * do spawn { * log(error, "Hello, World!"); * } * ~~~ @@ -434,7 +434,7 @@ fn spawn_listener(+f: fn~(comm::port)) -> comm::chan { * * let po = comm::port(); * let ch = comm::chan(po); - * let ch = spawn_listener {|po| + * let ch = do spawn_listener |po| { * // Now the child has a port called 'po' to read from and * // an environment-captured channel called 'ch'. * }; @@ -529,7 +529,7 @@ fn get_task() -> task { * # Example * * ~~~ - * task::unkillable {|| + * do task::unkillable { * // detach / yield / destroy must all be called together * rustrt::rust_port_detach(po); * // This must not result in the current task being killed