about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/std_example.rs
diff options
context:
space:
mode:
authorJP Posma <janpaul123@users.noreply.github.com>2022-03-16 09:34:12 -0700
committerGitHub <noreply@github.com>2022-03-16 09:34:12 -0700
commit80340f62fee46c1ac5ea787e4dcbe553c6abd41a (patch)
tree7256127b11375cf0bd94324fa5862cd48035b7eb /compiler/rustc_codegen_gcc/example/std_example.rs
parent461e8078010433ff7de2db2aaae8a3cfb0847215 (diff)
downloadrust-80340f62fee46c1ac5ea787e4dcbe553c6abd41a.tar.gz
rust-80340f62fee46c1ac5ea787e4dcbe553c6abd41a.zip
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! :)
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions