Remove extraneous [], replace accidental removed link to heap section
This commit is contained in:
parent
3a6dbb30a2
commit
fcc356373b
@ -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<T>`, so in this example `v` will have type
|
||||
`Vec<i32>`. 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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user