Skip to content
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

Clarify vec docs on deallocation (fixes #46879) #46884

Merged
merged 1 commit into from
Dec 22, 2017

Conversation

Manishearth
Copy link
Member

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 20, 2017
/// details are very subtle — if you intend to allocate memory using a `Vec`
/// and use it for something else (either to pass to unsafe code, or to build your
/// own memory-backed collection), be sure to deallocate this memory by using
/// `from_raw_parts` to recover the `Vec` and then dropping it.
Copy link

Choose a reason for hiding this comment

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

As a newb this is confusing. Maybe an explicit inline example would be good.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that might derail the docs; this is about the usage of vec in unsafe contexts and we don't want to go too deep in the weeds there.

(also, this paragraph is related to advanced usage of rust anyway)

@tinaun
Copy link
Contributor

tinaun commented Dec 21, 2017

“to recover the Vec and then dropping it” sounds weird but I don’t know if “drop it” is grammatically correct either

@steveklabnik
Copy link
Member

@bors: r+ rollup

@tinaun it doesn't sound odd to me; we might be able to simplify it by splitting the sentences up a bit, but this is good enough to fix the bug, imo.

@bors
Copy link
Contributor

bors commented Dec 21, 2017

📌 Commit 52c28ff has been approved by steveklabnik

@Manishearth
Copy link
Member Author

Manishearth commented Dec 21, 2017 via email

kennytm added a commit to kennytm/rust that referenced this pull request Dec 21, 2017
bors added a commit that referenced this pull request Dec 21, 2017
Rollup of 14 pull requests

- Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918
- Failed merges:
@bors bors merged commit 52c28ff into rust-lang:master Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants