Skip to content

Commit 22fbbd4

Browse files
Dangthrimblesteveklabnik
authored andcommitted
Some tidying up
Improving the use of 2nd and 3rd person Adding a few contractions to make the text less formal Tidying up some notes Providing a little bit more clarification for Windows users
1 parent f116ab5 commit 22fbbd4

File tree

4 files changed

+86
-83
lines changed

4 files changed

+86
-83
lines changed

src/doc/trpl/README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% The Rust Programming Language
22

3-
Welcome! This book will teach us about the [Rust Programming Language][rust].
3+
Welcome! This book will teach you about the [Rust Programming Language][rust].
44
Rust is a systems programming language focused on three goals: safety, speed,
55
and concurrency. It maintains these goals without having a garbage collector,
66
making it a useful language for a number of use cases other languages aren’t
@@ -17,7 +17,7 @@ Even then, Rust still allows precise control like a low-level language would.
1717
“The Rust Programming Language” is split into eight sections. This introduction
1818
is the first. After this:
1919

20-
* [Getting started][gs] - Set up our computer for Rust development.
20+
* [Getting started][gs] - Set up your computer for Rust development.
2121
* [Learn Rust][lr] - Learn Rust programming through small projects.
2222
* [Effective Rust][er] - Higher-level concepts for writing excellent Rust code.
2323
* [Syntax and Semantics][ss] - Each bit of Rust, broken down into small chunks.
@@ -33,11 +33,11 @@ is the first. After this:
3333
[gl]: glossary.html
3434
[bi]: bibliography.html
3535

36-
After reading this introduction, we’ll want to dive into either ‘Learn Rust’ or
37-
‘Syntax and Semantics’, depending on our preference: ‘Learn Rust’ if we want to
38-
dive in with a project, or ‘Syntax and Semantics’ if we prefer to start small,
39-
and learn a single concept thoroughly before moving onto the next. Copious
40-
cross-linking connects these parts together.
36+
After reading this introduction, you’ll want to dive into either ‘Learn Rust’ or
37+
‘Syntax and Semantics’, depending on your preference: ‘Learn Rust’ if you want
38+
to dive in with a project, or ‘Syntax and Semantics’ if you prefer to start
39+
small, and learn a single concept thoroughly before moving onto the next.
40+
Copious cross-linking connects these parts together.
4141

4242
### Contributing
4343

@@ -46,7 +46,7 @@ The source files from which this book is generated can be found on Github:
4646

4747
## A brief introduction to Rust
4848

49-
Is Rust a language we might be interested in? Let’s examine a few small code
49+
Is Rust a language you might be interested in? Let’s examine a few small code
5050
samples to show off a few of its strengths.
5151

5252
The main concept that makes Rust unique is called ‘ownership’. Consider this
@@ -76,7 +76,7 @@ annotating types.
7676

7777
Rust prefers stack allocation to heap allocation: `x` is placed directly on the
7878
stack. However, the `Vec<T>` type allocates space for the elements of the vector
79-
on the heap. If we’re not familiar with this distinction, we can ignore it for
79+
on the heap. If you’re not familiar with this distinction, you can ignore it for
8080
now, or check out [‘The Stack and the Heap’][heap]. As a systems programming
8181
language, Rust gives us the ability to control how our memory is allocated, but
8282
when we’re getting started, it’s less of a big deal.
@@ -104,13 +104,13 @@ fn main() {
104104
}
105105
```
106106

107-
We’ve introduced another binding, `y`. In this case, `y` is a ‘reference’ to
108-
the first element of the vector. Rust’s references are similar to pointers in
109-
other languages, but with additional compile-time safety checks. References
110-
interact with the ownership system by [‘borrowing’][borrowing] what they point
111-
to, rather than owning it. The difference is, when the reference goes out of
112-
scope, it will not deallocate the underlying memory. If it did, we’d
113-
de-allocate twice, which is bad!
107+
We’ve introduced another binding, `y`. In this case, `y` is a ‘reference’ to the
108+
first element of the vector. Rust’s references are similar to pointers in other
109+
languages, but with additional compile-time safety checks. References interact
110+
with the ownership system by [‘borrowing’][borrowing] what they point to, rather
111+
than owning it. The difference is, when the reference goes out of scope, it
112+
won't deallocate the underlying memory. If it did, we’d de-allocate twice, which
113+
is bad!
114114

115115
[borrowing]: references-and-borrowing.html
116116

@@ -146,7 +146,7 @@ fn main() {
146146

147147
Whew! The Rust compiler gives quite detailed errors at times, and this is one
148148
of those times. As the error explains, while we made our binding mutable, we
149-
still cannot call `push`. This is because we already have a reference to an
149+
still can't call `push`. This is because we already have a reference to an
150150
element of the vector, `y`. Mutating something while another reference exists
151151
is dangerous, because we may invalidate the reference. In this specific case,
152152
when we create the vector, we may have only allocated space for two elements.

src/doc/trpl/hello-cargo.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ any dependencies, so we’ll only be using the first part of its functionality.
1313
Eventually, we’ll add more. Since we started off by using Cargo, it'll be easy
1414
to add later.
1515

16-
If we installed Rust via the official installers we will also have Cargo. If we
17-
installed Rust some other way, we may want to [check the Cargo
18-
README][cargoreadme] for specific instructions about installing it.
16+
If you installed Rust via the official installers you will also have Cargo. If
17+
you installed Rust some other way, you may want to
18+
[check the Cargo README][cargoreadme] for specific instructions about installing
19+
it.
1920

2021
[cargoreadme]: https://github.com/rust-lang/cargo#installing-cargo-from-nightlies
2122

@@ -30,14 +31,14 @@ old executable (`main.exe` on Windows, `main` everywhere else). Let's do that pa
3031
```bash
3132
$ mkdir src
3233
$ mv main.rs src/main.rs
33-
$ rm main # or main.exe on Windows
34+
$ rm main # or 'rm main.exe' on Windows
3435
```
3536

36-
Note that since we're creating an executable, we retain `main.rs` as the source
37-
filename. If we want to make a library instead, we should use `lib.rs`. This
38-
convention is used by Cargo to successfully compile our projects, but it can be
39-
overridden if we wish. Custom file locations for the entry point can be
40-
specified with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file.
37+
> Note: since we're creating an executable, we retain `main.rs` as the source
38+
> filename. If we want to make a library instead, we should use `lib.rs`. This
39+
> convention is used by Cargo to successfully compile our projects, but it can
40+
> be overridden if we wish. Custom file locations for the entry point can be
41+
> specified with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file.
4142
4243
[crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target
4344

@@ -49,7 +50,7 @@ everything, and everything in its place.
4950
Next, our configuration file:
5051

5152
```bash
52-
$ editor Cargo.toml
53+
$ editor Cargo.toml # or 'notepad Cargo.toml' on Windows
5354
```
5455

5556
Make sure to get this name right: we need the capital `C`!
@@ -112,7 +113,7 @@ grows, we can just run `cargo build`, and it’ll work the right way.
112113
When our project is finally ready for release, we can use `cargo build
113114
--release` to compile our project with optimizations.
114115

115-
We'll also notice that Cargo has created a new file: `Cargo.lock`.
116+
You'll also notice that Cargo has created a new file: `Cargo.lock`.
116117

117118
```toml
118119
[root]
@@ -141,7 +142,7 @@ We don’t have to go through this whole process every time we want to start a n
141142
project! Cargo has the ability to make a bare-bones project directory in which
142143
we can start developing right away.
143144

144-
To start a new project with Cargo, use `cargo new`:
145+
To start a new project with Cargo, we use `cargo new`:
145146

146147
```bash
147148
$ cargo new hello_world --bin
@@ -178,8 +179,8 @@ authors = ["Your Name <[email protected]>"]
178179
```
179180

180181
Cargo has populated this file with reasonable defaults based off the arguments
181-
we gave it and our `git` global configuration. We may notice that Cargo has also
182-
initialized the `hello_world` directory as a `git` repository.
182+
we gave it and our `git` global configuration. You may notice that Cargo has
183+
also initialized the `hello_world` directory as a `git` repository.
183184

184185
Here’s what’s in `src/main.rs`:
185186

@@ -199,11 +200,11 @@ Now that we’ve got the tools down, let’s actually learn more about the Rust
199200
language itself. These are the basics that will serve us well through the rest
200201
of our time with Rust.
201202

202-
We have two options: Dive into a project with ‘[Learn Rust][learnrust]’, or
203-
start from the bottom and work our way up with[Syntax and Semantics][syntax]’.
204-
More experienced systems programmers will probably prefer ‘Learn Rust’, while
205-
those from dynamic backgrounds may enjoy either. Different people learn
206-
differently! Choose whatever’s right for us.
203+
You have two options: Dive into a project with ‘[Learn Rust][learnrust]’, or
204+
start from the bottom and work your way up with
205+
[Syntax and Semantics][syntax]’. More experienced systems programmers will
206+
probably prefer ‘Learn Rust’, while those from dynamic backgrounds may enjoy
207+
either. Different people learn differently! Choose whatever’s right for you.
207208

208209
[learnrust]: learn-rust.html
209210
[syntax]: syntax-and-semantics.html

src/doc/trpl/hello-world.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ thing to do.
99

1010
The first thing that we need to do is make a file to put our code in. I like to
1111
make a `projects` directory in my home directory, and keep all my projects
12-
there. Rust does not care where our code lives.
12+
there. Rust doesn't care where our code lives.
1313

1414
This actually leads to one other concern we should address: this guide will
1515
assume that we have basic familiarity with the command line. Rust itself makes
@@ -71,10 +71,10 @@ were arguments, they would go inside the parentheses (`(` and `)`), and because
7171
we aren’t returning anything from this function, we can omit the return type
7272
entirely. We’ll get to it later.
7373

74-
We’ll also note that the function is wrapped in curly braces (`{` and `}`). Rust
75-
requires these around all function bodies. It is also considered good style to
76-
put the opening curly brace on the same line as the function declaration, with
77-
one space in between.
74+
You’ll also note that the function is wrapped in curly braces (`{` and `}`).
75+
Rust requires these around all function bodies. It is also considered good style
76+
to put the opening curly brace on the same line as the function declaration,
77+
with one space in between.
7878

7979
Next up is this line:
8080

@@ -84,29 +84,29 @@ Next up is this line:
8484

8585
This line does all of the work in our little program. There are a number of
8686
details that are important here. The first is that it’s indented with four
87-
spaces, not tabs. Please configure our editor of choice to insert four spaces
88-
with the tab key. We provide some [sample configurations for various
89-
editors][configs].
87+
spaces, not tabs. Please configure your editor of choice to insert four spaces
88+
with the tab key. We provide some
89+
[sample configurations for various editors][configs].
9090

9191
[configs]: https://github.com/rust-lang/rust/tree/master/src/etc/CONFIGS.md
9292

9393
The second point is the `println!()` part. This is calling a Rust
9494
[macro][macro], which is how metaprogramming is done in Rust. If it were a
9595
function instead, it would look like this: `println()`. For our purposes, we
96-
don’t need to worry about this difference. Just know that sometimes, we’ll see a `!`,
97-
and that means that we’re calling a macro instead of a normal function. Rust
98-
implements `println!` as a macro rather than a function for good reasons, but
99-
that's an advanced topic. One last thing to mention: Rust’s macros are
100-
significantly different from C macros, if we’ve used those. Don’t be scared of
101-
using macros. We’ll get to the details eventually, we’ll just have to take it on
102-
trust for now.
96+
don’t need to worry about this difference. Just know that sometimes, we’ll see a
97+
`!`, and that means that we’re calling a macro instead of a normal function.
98+
Rust implements `println!` as a macro rather than a function for good reasons,
99+
but that's an advanced topic. One last thing to mention: Rust’s macros are
100+
significantly different from C macros, if you’ve used those. Don’t be scared of
101+
using macros. We’ll get to the details eventually, you’ll just have to take it
102+
on trust for now.
103103

104104
[macro]: macros.html
105105

106106
Next, `"Hello, world!"` is a ‘string’. Strings are a surprisingly complicated
107107
topic in a systems programming language, and this is a ‘statically allocated’
108-
string. If we want to read further about allocation, check out [the stack and
109-
the heap][allocation], but we don’t need to right now if we don’t want to. We
108+
string. If you want to read further about allocation, check out [the stack and
109+
the heap][allocation], but you don’t need to right now if you don’t want to. We
110110
pass this string as an argument to `println!`, which prints the string to the
111111
screen. Easy enough!
112112

@@ -127,8 +127,8 @@ compiler, `rustc`, by passing it the name of our source file:
127127
$ rustc main.rs
128128
```
129129

130-
This is similar to `gcc` or `clang`, if we come from a C or C++ background. Rust
131-
will output a binary executable. We can see it with `ls`:
130+
This is similar to `gcc` or `clang`, if you come from a C or C++ background.
131+
Rust will output a binary executable. We can see it with `ls`:
132132

133133
```bash
134134
$ ls
@@ -151,18 +151,19 @@ $ ./main # or main.exe on Windows
151151

152152
This prints out our `Hello, world!` text to our terminal.
153153

154-
If we come from a dynamic language like Ruby, Python, or JavaScript, we may not
155-
be used to these two steps being separate. Rust is an ‘ahead-of-time compiled
156-
language’, which means that we can compile a program, give it to someone else,
157-
and they don't need to have Rust installed. If we give someone a `.rb` or `.py`
158-
or `.js` file, they need to have a Ruby/Python/JavaScript implementation
159-
installed, but we just need one command to both compile and run our program.
160-
Everything is a tradeoff in language design, and Rust has made its choice.
154+
If you come from a dynamic language like Ruby, Python, or JavaScript, you may
155+
not be used to these two steps being separate. Rust is an ‘ahead-of-time
156+
compiled language’, which means that we can compile a program, give it to
157+
someone else, and they don't need to have Rust installed. If we give someone a
158+
`.rb` or `.py` or `.js` file, they need to have a Ruby/Python/JavaScript
159+
implementation installed, but we just need one command to both compile and run
160+
our program. Everything is a tradeoff in language design, and Rust has made its
161+
choice.
161162

162-
Congratulations! We have officially written a Rust program. That makes us Rust
163-
programmers! Welcome. 🎊🎉👍
163+
Congratulations! You have officially written a Rust program. That makes you a
164+
Rust programmer! Welcome. 🎊🎉👍
164165

165-
Next, I'd like to introduce us to another tool, Cargo, which is used to write
166+
Next, I'd like to introduce you to another tool, Cargo, which is used to write
166167
real-world Rust programs. Just using `rustc` is nice for simple things, but as
167168
our project grows, we'll want something to help us manage all of the options
168169
that it has, and to make it easy to share our code with other people and

src/doc/trpl/installing-rust.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,46 @@ $ sh rustup.sh
2424

2525
[insecurity]: http://curlpipesh.tumblr.com
2626

27-
If we're on Windows, please download the appropriate [installer][install-page].
28-
**NOTE:** By default, the Windows installer will not add Rust to the %PATH%
29-
system variable. If this is the only version of Rust we are installing and we
30-
want to be able to run it from the command line, click on "Advanced" on the
31-
install dialog and on the "Product Features" page ensure "Add to PATH" is
32-
installed on the local hard drive.
27+
If you're on Windows, please download the appropriate [installer][install-page].
28+
29+
> Note: By default, the Windows installer won't add Rust to the %PATH% system
30+
> variable. If this is the only version of Rust we are installing and we want to
31+
> be able to run it from the command line, click on "Advanced" on the install
32+
> dialog and on the "Product Features" page ensure "Add to PATH" is installed on
33+
> the local hard drive.
3334
3435

3536
[install-page]: https://www.rust-lang.org/install.html
3637

3738
## Uninstalling
3839

39-
If we decide we don't want Rust anymore, we'll be a bit sad, but that's okay.
40-
Not every programming language is great for everyone. Just run the uninstall
41-
script:
40+
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
41+
Not every programming language is great for everyone. We'll just run the
42+
uninstall script:
4243

4344
```bash
4445
$ sudo /usr/local/lib/rustlib/uninstall.sh
4546
```
4647

47-
If we used the Windows installer, just re-run the `.msi` and it will give us an
48-
uninstall option.
48+
If we used the Windows installer, we'll just re-run the `.msi` and it will give
49+
us an uninstall option.
4950

5051
## That disclaimer we promised
5152

5253
Some people, and somewhat rightfully so, get very upset when we tell them to
53-
`curl | sh`. Basically, when we do this, we are trusting that the good people
54-
who maintain Rust aren't going to hack our computer and do bad things. That's a
55-
good instinct! If we're one of those people, please check out the documentation
56-
on [building Rust from Source][from-source], or [the official binary
57-
downloads][install-page].
54+
`curl | sh`. Basically, when they do this, they are trusting that the good
55+
people who maintain Rust aren't going to hack their computer and do bad things.
56+
That's a good instinct! If you're one of those people, please check out the
57+
documentation on [building Rust from Source][from-source], or [the official
58+
binary downloads][install-page].
5859

5960
[from-source]: https://github.com/rust-lang/rust#building-from-source
6061

6162
## Platform support
6263

6364
Oh, we should also mention the officially supported platforms:
6465

65-
* Windows (7, 8, Server 2008 R2)
66+
* Windows (7 or later, Server 2008 R2)
6667
* Linux (2.6.18 or later, various distributions), x86 and x86-64
6768
* OSX 10.7 (Lion) or later, x86 and x86-64
6869

@@ -73,7 +74,7 @@ testing.
7374
Finally, a comment about Windows. Rust considers Windows to be a first-class
7475
platform upon release, but if we're honest, the Windows experience isn't as
7576
integrated as the Linux/OS X experience is. We're working on it! If anything
76-
does not work, it is a bug. Please let us know if that happens. Each and every
77+
doesn't work, it is a bug. Please let us know if that happens. Each and every
7778
commit is tested against Windows just like any other platform.
7879

7980
## After installation

0 commit comments

Comments
 (0)