Skip to content
This repository was archived by the owner on Nov 11, 2019. It is now read-only.

Commit a1889b0

Browse files
committed
Update content for 0.8
1 parent 0a29dba commit a1889b0

13 files changed

+1950
-2300
lines changed

book/chapter-01.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ Here's "Hello World" in Rust:
5353
Here's a parallel "Hello World" in Rust:
5454

5555
fn main() {
56-
for 10.times {
56+
do 10.times {
5757
do spawn {
58-
let greeting\_message = "Hello?";
59-
println(greeting\_message);
58+
let greeting_message = "Hello?";
59+
println(greeting_message);
6060
}
6161
}
6262
}

book/chapter-02.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
Installing Rust
22
===============
33

4-
Most Rubyists use OS X, and I haven't personally installed Rust on other
5-
platforms yet, so I'm just covering OS X for now. I'll add Windows and
6-
Linux instructions once I've tried them out myself.
4+
Most Rubyists use OS X, and Rust is pretty easy to get going on it:
75

86
Mac OS X
97
--------
@@ -15,41 +13,42 @@ already use. Just do this:
1513

1614
If you don't use Homebrew, install it. Seriously.
1715

18-
(Note: Homebrew doesn't have 0.7 yet, you can use
19-
brew install --HEAD rust to get master, which is a close approximation
20-
of 0.7 right now)
16+
(Note: If you're reading this close to release, Homebrew may not have 0.8 yet,
17+
you can use brew install --HEAD rust to get master, which will be close.)
2118

2219
Linux
2320
-----
2421

25-
Rust does the Standard Unix Thing.
22+
I personally use Linux, and Rust works quite well on it. Rust does the Standard
23+
Unix Thing.
2624

27-
$ curl -O http://static.rust-lang.org/dist/rust-0.7.tar.gz
28-
$ tar -xzf rust-0.7.tar.gz
29-
$ cd rust-0.7
25+
$ curl -O http://static.rust-lang.org/dist/rust-0.8.tar.gz
26+
$ tar -xzf rust-0.8.tar.gz
27+
$ cd rust-0.8
3028
$ ./configure
3129
$ make
3230
$ sudo make install
3331

34-
Most package managers I've checked out either have no package or a
35-
really old package, so you'll probably want to just install from source.
32+
Most package managers I've checked out either have no package or a really old
33+
package, so you'll probably want to just install from source.
3634

3735
Windows
3836
-------
3937

40-
I have not tried to install Rust on Windows, but I hear it works well.
41-
You can use the
42-
[installer](http://static.rust-lang.org/dist/rust-0.7-install.exe). You
43-
will need a very specific mingw setup. It's easier to build rust, and
44-
there's instructions on the
38+
See instructions on the
4539
[wiki](https://github.com/mozilla/rust/wiki/Note-getting-started-developing-Rust#windows).
40+
Overall, Rust wants to have strong Windows support, but some of it is in flux,
41+
and it was decided that the 0.8 release would be a bit wonky. Don't be afraid to
42+
hop into [the Rust
43+
IRC](http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust) and
44+
ask for help.
4645

4746
Future Proofing
4847
---------------
4948

50-
The version this book is written for is 0.7. The language has largely
51-
calmed down, so it should be pretty future-proof code. I'll be tweaking
52-
it with every new release.
49+
The version this book is written for is 0.8.While the language itself is pretty
50+
stable, things like the standard library and some major subsystems are being
51+
revised. I'll be tweaking it with every new release.
5352

5453
If you run
5554

book/chapter-03.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,15 @@ above. To run your program, do the Usual UNIX Thing:
3333
$ ./hello
3434

3535
And you should see "Hello, world." print to the screen. Congrats!
36+
37+
There's an easier way to do this, too. Rust provides another tool, `rust`,
38+
which wraps up a lot of functionality. We won't use `rustc` directly for the
39+
rest of this book, because you almost always want to be working with the
40+
higher-level tooling. Check it:
41+
42+
$ rust run hello.rs
43+
Hello, world!
44+
45+
Yup, `rust run` combines the compile and run step. This will probably feel more
46+
normal to you than keeping the two steps apart. It's only good for simple things,
47+
though: soon enough we'll be using `rustpkg` instead. But that's for later...

book/chapter-04.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,20 @@ In Rust, you annotate test methods like such:
1414
}
1515

1616
You'll note that tests take no arguments and return nothing. If the
17-
method runs, the test passes, and if it errors in some way, the test
17+
function runs, the test passes, and if it errors in some way, the test
1818
fails. Let's give it a shot: Open up `testing.rs` and put this in it:
1919

2020
#[test]
2121
fn this_tests_code() {
2222
println("")
2323
}
2424

25-
Then, compile it with the `--test` flag, and run it:
25+
Then, use `rust run`'s buddy, `rust test`:
2626

27-
$ rustc --test testing.rs --test
28-
$ ./testing
27+
$ rust test testing.rs
2928

3029
You should get some output that looks like this:
3130

32-
$ ./testing
33-
3431
running 1 test
3532

3633
test this_tests_code ... ok
@@ -63,7 +60,4 @@ Recompile, and the output should be:
6360
You can see it gives us the message, the file name, and the line number.
6461
Great.
6562

66-
Super simple. That's all you need to know to get started. But before we
67-
build our first 'real' Rust app with tests, we should deal with this
68-
whole compilation bit. It's really annoying to keep typing two commands
69-
just to run things. Let's build a bit of infrastructure first.
63+
Super simple. That's all you need to know to get started. Next up: FizzBuzz.

0 commit comments

Comments
 (0)