Skip to content

tutorial: rewrite the section vectors/strings #10354

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

Merged
merged 1 commit into from
Nov 8, 2013
Merged

tutorial: rewrite the section vectors/strings #10354

merged 1 commit into from
Nov 8, 2013

Conversation

thestinger
Copy link
Contributor

This section desperately needs to be expanded, but removing the
misleading/incorrect information is a priority.

Managed vectors/strings are not covered, as they are feature-gated and
are only a micro-optimization to avoid double-indirection.

Closes #6882

Fixed-size vectors are an unboxed block of memory, with the element length as
part of the type. A fixed-size vector owns the elements it contains, so the
elements are mutable if the vector is mutable. Fixed-size strings do not exist,
because mutating a string may require altering the length.
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth mentioning the limitations of fixed-size vectors (i.e. the fact they don't implement traits), just as a > Note: fixed-size vectors have bugs....?

(Also, this "because ..." doesn't seem necessary (i.e. just say "Fixed-size strings do not exist."), since e.g. string literals are immutable, so they could, in theory, be [u8, .. len] behind the scenes.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that limitation would belong in the more comprehensive manual.

This section desperately needs to be expanded, but removing the
misleading/incorrect information is a priority.

Managed vectors/strings are not covered, as they are feature-gated and
are only a micro-optimization to avoid double-indirection.

Closes #6882
bors added a commit that referenced this pull request Nov 8, 2013
This section desperately needs to be expanded, but removing the
misleading/incorrect information is a priority.

Managed vectors/strings are not covered, as they are feature-gated and
are only a micro-optimization to avoid double-indirection.

Closes #6882
@bors bors closed this Nov 8, 2013
@bors bors merged commit eca52e6 into rust-lang:master Nov 8, 2013
@thestinger thestinger deleted the vector branch November 9, 2013 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs reference local and exchange heap without explanation
3 participants