Skip to content

Commit 29ef59e

Browse files
committed
---
yaml --- r: 6077 b: refs/heads/master c: 4fec179 h: refs/heads/master i: 6075: 3e29060 v: v3
1 parent 50f3e8a commit 29ef59e

File tree

10 files changed

+64
-12
lines changed

10 files changed

+64
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a6d856c57c7b61106d08dcc3444b0f394ff2c73e
2+
refs/heads/master: 4fec1798d0d7177c6d15b825d69f2db1a2e814ff

trunk/doc/tutorial/args.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ and `&&` for by(-immutable)-reference. It is sometimes necessary to
105105
override the defaults. We'll talk more about this when discussing
106106
[generics][gens].
107107

108-
[gens]: FIXME
108+
[gens]: generic.html
109109

110110
## Other uses of safe references
111111

trunk/doc/tutorial/control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ handle the failure, allowing the program to continue running.
148148
to access a vector out of bounds, or running a pattern match with no
149149
matching clauses, both result in the equivalent of a `fail`.
150150

151-
[tasks]: FIXME
151+
[tasks]: task.html
152152

153153
## Logging
154154

trunk/doc/tutorial/data.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,17 @@ strings. They are always immutable.
292292

293293
## Resources
294294

295-
FIXME fill this in
295+
Resources are data types that have a destructor associated with them.
296+
297+
resource file_desc(fd: int) {
298+
close_file_desc(fd);
299+
}
300+
301+
This defines a type `file_desc` and a constructor of the same name,
302+
which takes an integer. Values of such a type can not be copied, and
303+
when they are destroyed (by going out of scope, or, when boxed, when
304+
their box is cleaned up), their body runs. In the example above, this
305+
would cause the given file descriptor to be closed.
306+
307+
NOTE: We're considering alternative approaches for data types with
308+
destructors. Resources might go away in the future.

trunk/doc/tutorial/generic.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ pass to a generic higher-order function as being passed by pointer:
102102

103103
NOTE: This is inconvenient, and we are hoping to get rid of this
104104
restriction in the future.
105+
106+
FIXME discuss kinds, when they have settled
107+

trunk/doc/tutorial/mod.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ It is also possible to include multiple files in a crate. For this
3535
purpose, you create a `.rc` crate file, which references any number of
3636
`.rs` code files. A crate file could look like this:
3737

38-
#[link(name = "farm", vers = "2.5", author = "mjh")]
38+
#[link(name = "farm", vers = "2.5", author = "mjh")];
3939
mod cow;
4040
mod chicken;
4141
mod horse;
@@ -90,7 +90,7 @@ local name `myfarm`.
9090

9191
Our example crate declared this set of `link` attributes:
9292

93-
#[link(name = "farm", vers = "2.5", author = "mjh")]
93+
#[link(name = "farm", vers = "2.5", author = "mjh")];
9494

9595
The version does not match the one provided in the `use` directive, so
9696
unless the compiler can find another crate with the right version
@@ -102,14 +102,13 @@ Now for something that you can actually compile yourself. We have
102102
these two files:
103103

104104
// mylib.rs
105+
#[link(name = "mylib", vers = "1.0")];
105106
fn world() -> str { "world" }
106107

107108
// main.rs
108109
use mylib;
109110
fn main() { log_err "hello " + mylib::world(); }
110111

111-
FIXME the compiler currently complains about missing link metas when you compile this
112-
113112
Now compile and run like this (adjust to your platform if necessary):
114113

115114
> rustc --lib mylib.rs

trunk/doc/tutorial/order

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ generic
99
mod
1010
ffi
1111
task
12+
test

trunk/doc/tutorial/setup.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Rust program files are, by convention, given the extension `.rs`. Say
1010
we have a file `hello.rs` containing this program:
1111

1212
use std;
13-
fn main() {
14-
std::io::println("hello world!");
13+
fn main(args: [str]) {
14+
std::io::println("hello world from " + args[0] + "!");
1515
}
1616

1717
If the Rust compiler was installed successfully, running `rustc
@@ -30,7 +30,16 @@ into an error.
3030

3131
## Anatomy of a Rust program
3232

33-
FIXME say something about libs, main, modules, use
33+
In its simplest form, a Rust program is simply a `.rs` file with some
34+
types and functions defined in it. If it has a `main` function, it can
35+
be compiled to an executable. Rust does not allow code that's not a
36+
declaration to appear at the top level of the file—all statements must
37+
live inside a function.
38+
39+
Rust programs can also be compiled as libraries, and included in other
40+
programs. The `use std` directive that appears at the top of a lot of
41+
examples imports the standard library. This is described in more
42+
detail [later on](mod.html).
3443

3544
## Editing Rust code
3645

trunk/doc/tutorial/syntax.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,28 @@ exists, convert the result of the expression to the given type.
280280

281281
## Attributes
282282

283-
FIXME Briefly introduce attributes
283+
Every definition can be annotated with attributes. Attributes are meta
284+
information that can serve a variety of purposes. One of those is
285+
conditional compilation:
286+
287+
#[cfg(target_os = "win32")]
288+
fn register_win_service() { /* ... */ }
289+
290+
This will cause the function to vanish without a trace during
291+
compilation on a non-Windows platform. Attributes always look like
292+
`#[attr]`, where `attr` can be simply a name (as in `#[test]`, which
293+
is used by the [built-in test framework](test.html)), a name followed
294+
by `=` and then a literal (as in `#[license = "BSD"]`, which is a
295+
valid way to annotate a Rust program as being released under a
296+
BSD-style license), or a name followed by a comma-separated list of
297+
nested attributes, as in the `cfg` example above.
298+
299+
An attribute without a semicolon following it applies to the
300+
definition that follows it. When terminated with a semicolon, it
301+
applies to the current context. The above example could also be
302+
written like this:
303+
304+
fn register_win_service() {
305+
#[cfg(target_os = "win32")];
306+
/* ... */
307+
}

trunk/doc/tutorial/test.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Testing
2+
3+
FIXME to be written

0 commit comments

Comments
 (0)