Skip to content

Commit 64b1a0d

Browse files
committed
Cosmetic updates to TRPL text
* Make messages match rustc's error messages * Use correct function name in example * Rewording to match previously presented material
1 parent 099b411 commit 64b1a0d

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

src/doc/trpl/arrays-vectors-and-slices.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ backed by arrays. Slices have type `&[T]`, which we'll talk about when we cover
9494
generics.
9595

9696
We have now learned all of the most basic Rust concepts. We're ready to start
97-
building our guessing game, we just need to know one last thing: how to get
98-
input from the keyboard. You can't have a guessing game without the ability to
99-
guess!
97+
building ourselves a guessing game, we just need to know one last thing: how to
98+
get input from the keyboard. You can't have a guessing game without the ability
99+
to guess!

src/doc/trpl/comments.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ fn hello(name: &str) {
4040
```
4141

4242
When writing doc comments, adding sections for any arguments, return values,
43-
and providing some examples of usage is very, very helpful.
43+
and providing some examples of usage is very, very helpful. Don't worry about
44+
the `&str`, we'll get to it soon.
4445

4546
You can use the [`rustdoc`](../rustdoc.html) tool to generate HTML documentation
4647
from these doc comments.

src/doc/trpl/compound-data-types.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ let x: (i32, &str) = (1, "hello");
2323
As you can see, the type of a tuple looks just like the tuple, but with each
2424
position having a type name rather than the value. Careful readers will also
2525
note that tuples are heterogeneous: we have an `i32` and a `&str` in this tuple.
26-
You haven't seen `&str` as a type before, and we'll discuss the details of
27-
strings later. In systems programming languages, strings are a bit more complex
28-
than in other languages. For now, just read `&str` as a *string slice*, and
29-
we'll learn more soon.
26+
You have briefly seen `&str` used as a type before, and we'll discuss the
27+
details of strings later. In systems programming languages, strings are a bit
28+
more complex than in other languages. For now, just read `&str` as a *string
29+
slice*, and we'll learn more soon.
3030

3131
You can access the fields in a tuple through a *destructuring let*. Here's
3232
an example:

src/doc/trpl/functions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ Unlike `let`, you _must_ declare the types of function arguments. This does
5959
not work:
6060

6161
```{ignore}
62-
fn print_number(x, y) {
62+
fn print_sum(x, y) {
6363
println!("x is: {}", x + y);
6464
}
6565
```
6666

6767
You get this error:
6868

6969
```text
70-
hello.rs:5:18: 5:19 error: expected `:` but found `,`
70+
hello.rs:5:18: 5:19 expected one of `!`, `:`, or `@`, found `)`
7171
hello.rs:5 fn print_number(x, y) {
7272
```
7373

src/doc/trpl/if.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ let y: i32 = if x == 5 { 10; } else { 15; };
126126
Note the semicolons after the 10 and 15. Rust will give us the following error:
127127

128128
```text
129-
error: mismatched types: expected `i32` but found `()` (expected i32 but found ())
129+
error: mismatched types: expected `i32`, found `()` (expected i32, found ())
130130
```
131131

132132
We expected an integer, but we got `()`. `()` is pronounced *unit*, and is a

src/doc/trpl/variable-bindings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ let x;
9898
...we'll get an error:
9999

100100
```text
101-
src/main.rs:2:9: 2:10 error: cannot determine a type for this local variable: unconstrained type
101+
src/main.rs:2:9: 2:10 error: unable to infer enough type information about `_`; type annotations required
102102
src/main.rs:2 let x;
103103
^
104104
```

0 commit comments

Comments
 (0)