-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some minor docs improvements for TRPL #30755
Changes from 4 commits
e22ceea
3557e69
936678a
3a6dbb3
fcc3563
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,15 +51,24 @@ fn foo() { | |
} | ||
``` | ||
|
||
When `v` comes into scope, a new [`Vec<T>`][vect] is created. In this case, the | ||
vector also allocates space on [the heap][heap], for the three 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. | ||
When `v` comes into scope, a new [vector][] is created, and it allocates space | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need the empty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was going to blame my preferred markdown tool for not supporting this syntax, turns out it does! Today I learned. Will fix. |
||
on the heap for each of its elements. When `v` goes out of scope at the end of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the link to the heap section? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops! That was accidental. Will do. |
||
`foo()`, Rust will clean up everything related to the vector, even the | ||
heap-allocated memory. This happens deterministically, at the end of the scope. | ||
|
||
[vect]: ../std/vec/struct.Vec.html | ||
We'll cover [vectors][vector] 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 | ||
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 | ||
[heap]: the-stack-and-the-heap.html | ||
[bindings]: variable-bindings.html | ||
[generics]: generics.html | ||
|
||
# Move semantics | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has always been a confusing-ish pain point: what is a section and what is a chapter? Syntax and Semantics is wayyy to long for a chapter, but the others are too short.
Oh well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considered LaTeX-style Part / Chapter / Section divisions? Not all Parts need to be broken into Chapters, iirc. But maybe this is only intuitive for me because I've authored LaTeX documents before. Probably not worth a bikeshed discussion, so I won't modify this any further within this PR.