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

Add note about pointer state after the call. #23561

Merged
merged 1 commit into from
Mar 24, 2015

Conversation

steveklabnik
Copy link
Member

Fixes #23422

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

Some reallocations can succeed in-place I believe, so in that sense this may not be 100% true because the same pointer could be returned. Perhaps something like:

The memory at the passed-in pointer is undefined after the call if the allocation was relocated.

@steveklabnik
Copy link
Member Author

@alexcrichton fixed, i just re-ordered the sentence

@@ -26,6 +26,10 @@ pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 {
///
/// On failure, return a null pointer and leave the original allocation intact.
///
/// If the allocation was relocated, the memory at the passed-in pointer is undefined after the
/// call.
///
Copy link
Member

Choose a reason for hiding this comment

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

stray double newline, I'd also tend to preserve the surrounding style by wrapping to 80 chars as well. Other than that though r=me

Copy link
Member Author

Choose a reason for hiding this comment

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

Our vim files auto-wrap at 100, so doing this is a manual thing, which kinda sucks. I'll still do it here, this just keeps cropping up.

@steveklabnik
Copy link
Member Author

@bors: r=alexcrichton rollup

@bors
Copy link
Contributor

bors commented Mar 23, 2015

📌 Commit 2750e3c has been approved by alexcrichton

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.

heap::reallocate doesn't specify state of old pointer on success
4 participants