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

Docs: make Vec::from_raw_parts documentation less strict #95016

Merged
merged 1 commit into from
Mar 28, 2022

Commits on Mar 16, 2022

  1. Docs: make Vec::from_raw_parts documentation less strict

    This is my first PR; be gentle!
    
    In https://users.rust-lang.org/t/why-does-vec-from-raw-parts-require-same-size-and-not-same-size-capacity/73036/2?u=janpaul123 it was suggested to me that I should make a PR to make the documentation of `Vec::from_raw_parts` less strict, since we don't require `T` to have the same size, just `size_of::<T>() * capacity` to be the same, since that is what results in `Layout::size` being the same in `dealloc`, which is really what matters.
    
    Also in https://users.rust-lang.org/t/why-does-vec-from-raw-parts-require-same-size-and-not-same-size-capacity/73036/8?u=janpaul123 it was suggested that it's better to use `slice::from_raw_parts`, which I think is useful advise that could also be mentioned in the docs, so I added that too.
    
    Let me know what you think! :)
    janpaul123 authored Mar 16, 2022
    Configuration menu
    Copy the full SHA
    80340f6 View commit details
    Browse the repository at this point in the history