rollup merge of #17277 : steveklabnik/doc_fix_rollup

This commit is contained in:
Alex Crichton 2014-09-17 08:49:06 -07:00
commit b4bff574d2
2 changed files with 12 additions and 17 deletions

View File

@ -392,14 +392,10 @@ By the way, in these examples, `i` indicates that the number is an integer.
Rust is a statically typed language, which means that we specify our types up
front. So why does our first example compile? Well, Rust has this thing called
"[Hindley-Milner type
inference](http://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system)",
named after some really smart type theorists. If you clicked that link, don't
be scared: what this means for you is that Rust will attempt to infer the types
in your program, and it's pretty good at it. If it can infer the type, Rust
"type inference." If it can figure out what the type of something is, Rust
doesn't require you to actually type it out.
We can add the type if we want to. Types come after a colon (`:`):
We can add the type if we want to, though. Types come after a colon (`:`):
```{rust}
let x: int = 5;
@ -1281,15 +1277,15 @@ two main looping constructs: `for` and `while`.
The `for` loop is used to loop a particular number of times. Rust's `for` loops
work a bit differently than in other systems languages, however. Rust's `for`
loop doesn't look like this C `for` loop:
loop doesn't look like this "C style" `for` loop:
```{ignore,c}
```{c}
for (x = 0; x < 10; x++) {
printf( "%d\n", x );
}
```
It looks like this:
Instead, it looks like this:
```{rust}
for x in range(0i, 10i) {
@ -1312,10 +1308,9 @@ valid for the loop body. Once the body is over, the next value is fetched from
the iterator, and we loop another time. When there are no more values, the
`for` loop is over.
In our example, the `range` function is a function, provided by Rust, that
takes a start and an end position, and gives an iterator over those values. The
upper bound is exclusive, though, so our loop will print `0` through `9`, not
`10`.
In our example, `range` is a function that takes a start and an end position,
and gives an iterator over those values. The upper bound is exclusive, though,
so our loop will print `0` through `9`, not `10`.
Rust does not have the "C style" `for` loop on purpose. Manually controlling
each element of the loop is complicated and error prone, even for experienced C

View File

@ -86,10 +86,10 @@ There are questions that are asked quite often, and so we've made FAQs for them:
# The standard library
You can find function-level documentation for the entire standard library
[here](std/index.html). There's a list of crates on the left with more specific
sections, or you can use the search bar at the top to search for something if
you know its name.
We have [API documentation for the entire standard
library](std/index.html). There's a list of crates on the left with more
specific sections, or you can use the search bar at the top to search for
something if you know its name.
# External documentation