about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichał Czardybon <mczard@poczta.onet.pl>2015-05-08 22:15:14 +0200
committerMichał Czardybon <mczard@poczta.onet.pl>2015-05-11 09:02:25 +0200
commitbff170786cd99bfca7669430fdcc0889a01d2906 (patch)
tree8db9d9b041eb3e4df52d1b7ef475fe520533e12d
parent73345185793cca8a0b4c77aa87973a2634a0c492 (diff)
downloadrust-bff170786cd99bfca7669430fdcc0889a01d2906.tar.gz
rust-bff170786cd99bfca7669430fdcc0889a01d2906.zip
Fixed one textual mistake and one casing error.
Corrected "Ownership":

- [`Variable bindings`] link was not processed properly.
- Changed the paragraph about move semantics with two vectors, because it was confusing.
- Removed "So it may not be as inefficient as it initially seems", because there is nothing that seems inefficient in copying pointers only.
- Other text corrections.

Fixed copied-and-pasted text mistakes.

Revised the paragraph about moving a vector (taking into account suggestions by echochamber).

Fixed markdown.

Fixes requested by steveklabnik.

Brought back a sentence about supposed inefficiency.
-rw-r--r--src/doc/trpl/lifetimes.md2
-rw-r--r--src/doc/trpl/ownership.md28
-rw-r--r--src/doc/trpl/references-and-borrowing.md4
-rw-r--r--src/doc/trpl/while-loops.md2
4 files changed, 18 insertions, 18 deletions
diff --git a/src/doc/trpl/lifetimes.md b/src/doc/trpl/lifetimes.md
index 86164a08a43..25d5122b4e4 100644
--- a/src/doc/trpl/lifetimes.md
+++ b/src/doc/trpl/lifetimes.md
@@ -5,7 +5,7 @@ Rust’s most unique and compelling features, with which Rust developers should
 become quite acquainted. Ownership is how Rust achieves its largest goal,
 memory safety. There are a few distinct concepts, each with its own chapter:
 
-* [ownership][ownership], ownership, the key concept
+* [ownership][ownership], the key concept
 * [borrowing][borrowing], and their associated feature ‘references’
 * lifetimes, which you’re reading now
 
diff --git a/src/doc/trpl/ownership.md b/src/doc/trpl/ownership.md
index 971bb7cd700..b210f1c643f 100644
--- a/src/doc/trpl/ownership.md
+++ b/src/doc/trpl/ownership.md
@@ -6,7 +6,7 @@ become quite acquainted. Ownership is how Rust achieves its largest goal,
 memory safety. There are a few distinct concepts, each with its own
 chapter:
 
-* ownership, which you’re reading now.
+* ownership, which you’re reading now
 * [borrowing][borrowing], and their associated feature ‘references’
 * [lifetimes][lifetimes], an advanced concept of borrowing
 
@@ -23,7 +23,7 @@ Before we get to the details, two important notes about the ownership system.
 Rust has a focus on safety and speed. It accomplishes these goals through many
 ‘zero-cost abstractions’, which means that in Rust, abstractions cost as little
 as possible in order to make them work. The ownership system is a prime example
-of a zero cost abstraction. All of the analysis we’ll talk about in this guide
+of a zero-cost abstraction. All of the analysis we’ll talk about in this guide
 is _done at compile time_. You do not pay any run-time cost for any of these
 features.
 
@@ -41,7 +41,7 @@ With that in mind, let’s learn about ownership.
 
 # Ownership
 
-[`Variable bindings`][bindings] have a property in Rust: they ‘have ownership’
+[Variable bindings][bindings] have a property in Rust: they ‘have ownership’
 of what they’re bound to. This means that when a binding goes out of scope, the
 resource that they’re bound to are freed. For example:
 
@@ -106,8 +106,8 @@ take(v);
 println!("v[0] is: {}", v[0]);
 ```
 
-Same error: “use of moved value.” When we transfer ownership to something else,
-we say that we’ve ‘moved’ the thing we refer to. You don’t need some sort of
+Same error: ‘use of moved value’. When we transfer ownership to something else,
+we say that we’ve ‘moved’ the thing we refer to. You don’t need any sort of
 special annotation here, it’s the default thing that Rust does.
 
 ## The details
@@ -121,19 +121,19 @@ let v = vec![1, 2, 3];
 let v2 = v;
 ```
 
-The first line creates some data for the vector on the [stack][sh], `v`. The
-vector’s data, however, is stored on the [heap][sh], and so it contains a
-pointer to that data. When we move `v` to `v2`, it creates a copy of that pointer,
-for `v2`. Which would mean two pointers to the contents of the vector on the
-heap. That would be a problem: it would violate Rust’s safety guarantees by
-introducing a data race. Therefore, Rust forbids using `v` after we’ve done the
-move.
+The first line allocates memory for the vector object, `v`, and for the data it
+contains. The vector object is stored on the [stack][sh] and contains a pointer
+to the content (`[1, 2, 3]`) stored on the [heap][sh]. When we move `v` to `v2`,
+it creates a copy of that pointer, for `v2`. Which means that there would be two
+pointers to the content of the vector on the heap. It would violate Rust’s
+safety guarantees by introducing a data race. Therefore, Rust forbids using `v`
+after we’ve done the move.
 
 [sh]: the-stack-and-the-heap.html
 
 It’s also important to note that optimizations may remove the actual copy of
-the bytes, depending on circumstances. So it may not be as inefficient as it
-initially seems.
+the bytes on the stack, depending on circumstances. So it may not be as
+inefficient as it initially seems.
 
 ## `Copy` types
 
diff --git a/src/doc/trpl/references-and-borrowing.md b/src/doc/trpl/references-and-borrowing.md
index da416e994c4..c434371ce59 100644
--- a/src/doc/trpl/references-and-borrowing.md
+++ b/src/doc/trpl/references-and-borrowing.md
@@ -6,7 +6,7 @@ become quite acquainted. Ownership is how Rust achieves its largest goal,
 memory safety. There are a few distinct concepts, each with its own
 chapter:
 
-* [ownership][ownership], ownership, the key concept
+* [ownership][ownership], the key concept
 * borrowing, which you’re reading now
 * [lifetimes][lifetimes], an advanced concept of borrowing
 
@@ -368,4 +368,4 @@ statement 1 at 3:14
     
     println!("{}", y);
 }
-```
\ No newline at end of file
+```
diff --git a/src/doc/trpl/while-loops.md b/src/doc/trpl/while-loops.md
index f2e2f6b6f49..e71d2033f49 100644
--- a/src/doc/trpl/while-loops.md
+++ b/src/doc/trpl/while-loops.md
@@ -1,4 +1,4 @@
-% while loops
+% while Loops
 
 Rust also has a `while` loop. It looks like this: