Skip to content

Commit 45a68c1

Browse files
committed
---
yaml --- r: 208382 b: refs/heads/snap-stage3 c: a5cac55 h: refs/heads/master v: v3
1 parent cef3998 commit 45a68c1

File tree

31 files changed

+404
-659
lines changed

31 files changed

+404
-659
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 866991e273a8edf3062a231079e7ef37ecad18b7
4+
refs/heads/snap-stage3: a5cac55be451a32a5956339009c49ac4fcaaef5c
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/doc/index.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ to jump to any particular section.
55

66
# Getting Started
77

8-
If you haven't seen Rust at all yet, the first thing you should read is the
9-
introduction to [The Rust Programming Language](book/index.html). It'll give
10-
you a good idea of what Rust is like.
11-
12-
The book provides a lengthy explanation of Rust, its syntax, and its
13-
concepts. Upon completing the book, you'll be an intermediate Rust
14-
developer, and will have a good grasp of the fundamental ideas behind
15-
Rust.
8+
If you haven't seen Rust at all yet, the first thing you should read is the [30
9+
minute intro](intro.html). It will give you an overview of the basic ideas of Rust
10+
at a high level.
11+
12+
Once you know you really want to learn Rust, the next step is reading [The
13+
Rust Programming Language](book/index.html). It is a lengthy explanation of
14+
Rust, its syntax, and its concepts. Upon completing the book, you'll be an
15+
intermediate Rust developer, and will have a good grasp of the fundamental
16+
ideas behind Rust.
1617

1718
[Rust By Example][rbe] was originally a community resource, but was then
1819
donated to the Rust project. As the name implies, it teaches you Rust through a

branches/snap-stage3/src/doc/trpl/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
* [Concurrency](concurrency.md)
1616
* [Error Handling](error-handling.md)
1717
* [FFI](ffi.md)
18-
* [Borrow and AsRef](borrow-and-asref.md)
1918
* [Syntax and Semantics](syntax-and-semantics.md)
2019
* [Variable Bindings](variable-bindings.md)
2120
* [Functions](functions.md)

branches/snap-stage3/src/doc/trpl/borrow-and-asref.md

Lines changed: 0 additions & 93 deletions
This file was deleted.

branches/snap-stage3/src/doc/trpl/lifetimes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Rust’s most unique and compelling features, with which Rust developers should
55
become quite acquainted. Ownership is how Rust achieves its largest goal,
66
memory safety. There are a few distinct concepts, each with its own chapter:
77

8-
* [ownership][ownership], the key concept
8+
* [ownership][ownership], ownership, the key concept
99
* [borrowing][borrowing], and their associated feature ‘references’
1010
* lifetimes, which you’re reading now
1111

branches/snap-stage3/src/doc/trpl/ownership.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ become quite acquainted. Ownership is how Rust achieves its largest goal,
66
memory safety. There are a few distinct concepts, each with its own
77
chapter:
88

9-
* ownership, which you’re reading now
9+
* ownership, which you’re reading now.
1010
* [borrowing][borrowing], and their associated feature ‘references’
1111
* [lifetimes][lifetimes], an advanced concept of borrowing
1212

@@ -23,7 +23,7 @@ Before we get to the details, two important notes about the ownership system.
2323
Rust has a focus on safety and speed. It accomplishes these goals through many
2424
‘zero-cost abstractions’, which means that in Rust, abstractions cost as little
2525
as possible in order to make them work. The ownership system is a prime example
26-
of a zero-cost abstraction. All of the analysis we’ll talk about in this guide
26+
of a zero cost abstraction. All of the analysis we’ll talk about in this guide
2727
is _done at compile time_. You do not pay any run-time cost for any of these
2828
features.
2929

@@ -41,7 +41,7 @@ With that in mind, let’s learn about ownership.
4141

4242
# Ownership
4343

44-
[Variable bindings][bindings] have a property in Rust: they ‘have ownership’
44+
[`Variable bindings`][bindings] have a property in Rust: they ‘have ownership’
4545
of what they’re bound to. This means that when a binding goes out of scope, the
4646
resource that they’re bound to are freed. For example:
4747

@@ -106,8 +106,8 @@ take(v);
106106
println!("v[0] is: {}", v[0]);
107107
```
108108

109-
Same error: use of moved value’. When we transfer ownership to something else,
110-
we say that we’ve ‘moved’ the thing we refer to. You don’t need any sort of
109+
Same error: use of moved value.” When we transfer ownership to something else,
110+
we say that we’ve ‘moved’ the thing we refer to. You don’t need some sort of
111111
special annotation here, it’s the default thing that Rust does.
112112

113113
## The details
@@ -121,19 +121,19 @@ let v = vec![1, 2, 3];
121121
let v2 = v;
122122
```
123123

124-
The first line allocates memory for the vector object, `v`, and for the data it
125-
contains. The vector object is stored on the [stack][sh] and contains a pointer
126-
to the content (`[1, 2, 3]`) stored on the [heap][sh]. When we move `v` to `v2`,
127-
it creates a copy of that pointer, for `v2`. Which means that there would be two
128-
pointers to the content of the vector on the heap. It would violate Rust’s
129-
safety guarantees by introducing a data race. Therefore, Rust forbids using `v`
130-
after we’ve done the move.
124+
The first line creates some data for the vector on the [stack][sh], `v`. The
125+
vector’s data, however, is stored on the [heap][sh], and so it contains a
126+
pointer to that data. When we move `v` to `v2`, it creates a copy of that pointer,
127+
for `v2`. Which would mean two pointers to the contents of the vector on the
128+
heap. That would be a problem: it would violate Rust’s safety guarantees by
129+
introducing a data race. Therefore, Rust forbids using `v` after we’ve done the
130+
move.
131131

132132
[sh]: the-stack-and-the-heap.html
133133

134134
It’s also important to note that optimizations may remove the actual copy of
135-
the bytes on the stack, depending on circumstances. So it may not be as
136-
inefficient as it initially seems.
135+
the bytes, depending on circumstances. So it may not be as inefficient as it
136+
initially seems.
137137

138138
## `Copy` types
139139

branches/snap-stage3/src/doc/trpl/primitive-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let x = true;
1515
let y: bool = false;
1616
```
1717

18-
A common use of booleans is in [`if` conditionals][if].
18+
A common use of booleans is in [`if` statements][if].
1919

2020
[if]: if.html
2121

branches/snap-stage3/src/doc/trpl/while-loops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
% while Loops
1+
% while loops
22

33
Rust also has a `while` loop. It looks like this:
44

branches/snap-stage3/src/libcollections/borrow.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ use self::Cow::*;
3737
/// trait: if `T: Borrow<U>`, then `&U` can be borrowed from `&T`. A given
3838
/// type can be borrowed as multiple different types. In particular, `Vec<T>:
3939
/// Borrow<Vec<T>>` and `Vec<T>: Borrow<[T]>`.
40-
///
41-
/// `Borrow` is very similar to, but different than, `AsRef`. See
42-
/// [the book][book] for more.
43-
///
44-
/// [book]: ../../book/borrow-and-asref.html
4540
#[stable(feature = "rust1", since = "1.0.0")]
4641
pub trait Borrow<Borrowed: ?Sized> {
4742
/// Immutably borrows from an owned value.

branches/snap-stage3/src/libcore/convert.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ use marker::Sized;
2424

2525
/// A cheap, reference-to-reference conversion.
2626
///
27-
/// `AsRef` is very similar to, but different than, `Borrow`. See
28-
/// [the book][book] for more.
29-
///
30-
/// [book]: ../../book/borrow-and-asref.html
31-
///
3227
/// # Examples
3328
///
3429
/// Both `String` and `&str` implement `AsRef<str>`:

0 commit comments

Comments
 (0)