Skip to content

Clarify memory structure of vectors in documentation #31666

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

dirk
Copy link
Contributor

@dirk dirk commented Feb 15, 2016

Tweak documentation to clarify the structure of Vecs as contiguous arrays of items in memory.

Closes #31554; contributes to #29380.

r? @steveklabnik

@@ -20,6 +20,12 @@ There’s an alternate form of `vec!` for repeating an initial value:
let v = vec![0; 10]; // ten zeroes
```

Vectors store their contents as contiguous arrays of `T` on the heap. This means
that they must be able to know the size of `T` at compile (that is, how many
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... at compile time (that is, ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkruppe: Nice catch, fixed!

@dirk dirk force-pushed the dirk/clarify-memory-arrangement-in-vec-docs branch 2 times, most recently from 3be559a to f9fe658 Compare February 15, 2016 06:30
@steveklabnik
Copy link
Member

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Feb 15, 2016

📌 Commit f9fe658 has been approved by steveklabnik

Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 15, 2016
…t-in-vec-docs, r=steveklabnik

Tweak documentation to clarify the structure of `Vec`s as contiguous arrays of items in memory.

Closes rust-lang#31554; contributes to rust-lang#29380.

r? @steveklabnik
Manishearth added a commit to Manishearth/rust that referenced this pull request Feb 16, 2016
…t-in-vec-docs, r=steveklabnik

Tweak documentation to clarify the structure of `Vec`s as contiguous arrays of items in memory.

Closes rust-lang#31554; contributes to rust-lang#29380.

r? @steveklabnik
bors added a commit that referenced this pull request Feb 17, 2016
…cs, r=steveklabnik

Tweak documentation to clarify the structure of `Vec`s as contiguous arrays of items in memory.

Closes #31554; contributes to #29380.

r? @steveklabnik
@bors
Copy link
Collaborator

bors commented Feb 17, 2016

⌛ Testing commit f9fe658 with merge f4046de...

@@ -11,8 +11,8 @@ let v = vec![1, 2, 3, 4, 5]; // v: Vec<i32>
```

(Notice that unlike the `println!` macro we’ve used in the past, we use square
brackets `[]` with `vec!` macro. Rust allows you to use either in either situation,
this is just convention.)
brackets `[]` with `vec!` macro. Rust allows you to use either in either
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either in either?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants