diff --git a/src/doc/book/ownership.md b/src/doc/book/ownership.md index 0a13d813f74..a62d31d362b 100644 --- a/src/doc/book/ownership.md +++ b/src/doc/book/ownership.md @@ -51,21 +51,21 @@ fn foo() { } ``` -When `v` comes into scope, a new [vector][] is created, and it allocates space -on the heap for each of its elements. When `v` goes out of scope at the end of -`foo()`, Rust will clean up everything related to the vector, even the +When `v` comes into scope, a new [vector] is created, and it allocates space on +[the heap][heap] for each of its elements. When `v` goes out of scope at the +end of `foo()`, Rust will clean up everything related to the vector, even the heap-allocated memory. This happens deterministically, at the end of the scope. -We'll cover [vectors][vector] in detail later in this chapter; we only use them +We'll cover [vectors] in detail later in this chapter; we only use them here as an example of a type that allocates space on the heap at runtime. They -behave like [arrays][], except their size may change by `push()`ing more +behave like [arrays], except their size may change by `push()`ing more elements onto them. Vectors have a [generic type][generics] `Vec`, so in this example `v` will have type `Vec`. We'll cover generics in detail later in this chapter. [arrays]: primitive-types.html#arrays -[vector]: vectors.html +[vectors]: vectors.html [heap]: the-stack-and-the-heap.html [bindings]: variable-bindings.html [generics]: generics.html diff --git a/src/doc/book/primitive-types.md b/src/doc/book/primitive-types.md index ccfa94ad8bb..d6188fa7cdc 100644 --- a/src/doc/book/primitive-types.md +++ b/src/doc/book/primitive-types.md @@ -167,7 +167,7 @@ variable binding. Slices have a defined length, can be mutable or immutable. ## Slicing syntax You can use a combo of `&` and `[]` to create a slice from various things. The -`&` indicates that slices are similar to [references][], which we will cover in +`&` indicates that slices are similar to [references], which we will cover in detail later in this section. The `[]`s, with a range, let you define the length of the slice: @@ -194,7 +194,7 @@ documentation][slice]. Rust’s `str` type is the most primitive string type. As an [unsized type][dst], it’s not very useful by itself, but becomes useful when placed behind a reference, like `&str`. We'll elaborate further when we cover -[Strings][strings] and [references][]. +[Strings][strings] and [references]. [dst]: unsized-types.html [strings]: strings.html