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

Realloc is a bit confusing #107875

Closed
alexevier opened this issue Feb 10, 2023 · 2 comments
Closed

Realloc is a bit confusing #107875

alexevier opened this issue Feb 10, 2023 · 2 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools

Comments

@alexevier
Copy link

Location

https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html#method.realloc

Summary

Realloc (in the trait for GlobalAlloc) is confusing in my opinion, what means the new_size parameter?
The size in bytes or how many times the size that is inside the layout?
In the way it is written seems to mean the bytes but it should be explicit that it means the size in bytes.

@alexevier alexevier added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Feb 10, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 10, 2023
…s, r=scottmcm

Clarify `new_size` for realloc means bytes

Minor docs fix requested by rust-lang#107875
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Feb 11, 2023
…s, r=scottmcm

Clarify `new_size` for realloc means bytes

Minor docs fix requested by rust-lang#107875
@workingjubilee
Copy link
Member

Thank you! I added a clarification to the docs (it is in bytes).

@alexevier
Copy link
Author

thank you, for taking to look into this

thomcc pushed a commit to tcdi/postgrestd that referenced this issue May 31, 2023
…tmcm

Clarify `new_size` for realloc means bytes

Minor docs fix requested by rust-lang/rust#107875
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

No branches or pull requests

2 participants