Skip to content

Tiny documentation fixes in rust.md and src/libcore/task.rs #2847

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 6 commits into from
Jul 9, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 11 additions & 11 deletions doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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`
Expand All @@ -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
Expand Down Expand Up @@ -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};
Expand All @@ -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)`)
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
* ~~~
Expand Down
33 changes: 16 additions & 17 deletions src/libcore/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* # Example
*
* ~~~
* spawn {||
* do spawn {
* log(error, "Hello, World!");
* }
* ~~~
Expand Down Expand Up @@ -344,7 +344,6 @@ fn run_with<A:send>(-builder: builder,
+f: fn~(+A)) {

/*!
*
* Runs a task, while transfering ownership of one argument to the
* child.
*
Expand Down Expand Up @@ -406,15 +405,13 @@ fn spawn(+f: fn~()) {

fn spawn_with<A:send>(+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)
Expand All @@ -437,7 +434,7 @@ fn spawn_listener<A:send>(+f: fn~(comm::port<A>)) -> comm::chan<A> {
*
* 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'.
* };
Expand Down Expand Up @@ -531,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);
* }
* ~~~
* 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
* task::yield();
* rustrt::rust_port_destroy(po);
* }
* ~~~
*/
unsafe fn unkillable(f: fn()) {
class allow_failure {
Expand Down