Skip to content

Try to clarify GlobalAlloc::realloc documentation comment. #82628

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
merged 1 commit into from
Mar 1, 2021

Conversation

vakaras
Copy link
Contributor

@vakaras vakaras commented Feb 28, 2021

This PR tries to improve the documentation of GlobalAlloc::realloc with two aspects:

  1. Explicitly mention that realloc preserves the contents of the original memory block.
  2. Explicitly mention which layout should be used to deallocate the reallocated block.

@rust-highfive
Copy link
Contributor

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 28, 2021
@Mark-Simulacrum
Copy link
Member

I think this is already a guarantee we were making, so going to go ahead and approve, but just in case cc @rust-lang/wg-allocators and @rust-lang/libs (feel free to deapprove if I'm wrong or we can revert)

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Mar 1, 2021

📌 Commit cdfff98 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 1, 2021
@Lokathor
Copy link
Contributor

Lokathor commented Mar 1, 2021

we do already implicitly require this, yeah. or vec wouldn't work. good to say it though.

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 1, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#82309 (Propagate RUSTDOCFLAGS in the environment when documenting)
 - rust-lang#82403 (rustbuild: print out env vars on verbose rustc invocations)
 - rust-lang#82507 (Rename the `tidy` binary to `rust-tidy`)
 - rust-lang#82531 (Add GUI tests)
 - rust-lang#82532 (Add `build.print_step_rusage` to config.toml)
 - rust-lang#82543 (fix env var name in CI)
 - rust-lang#82622 (Propagate `--test-args` for `x.py test src/tools/cargo`)
 - rust-lang#82628 (Try to clarify GlobalAlloc::realloc documentation comment.)
 - rust-lang#82630 (Fix a typo in the `find_anon_type` doc)
 - rust-lang#82643 (Add more proc-macro attribute tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1b9f420 into rust-lang:master Mar 1, 2021
@rustbot rustbot added this to the 1.52.0 milestone Mar 1, 2021
@joshtriplett
Copy link
Member

This looks great. Yes, realloc absolutely must preserve the existing contents.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants