Update safety requirements of Vec::from_raw_parts
?
#94950
Labels
A-allocators
Area: Custom and system allocators
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
C-bug
Category: This is a bug.
C-discussion
Category: Discussion or questions that doesn't represent real issues.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
T-opsem
Relevant to the opsem team
The “Safety” section of the document of
Vec::from_raw_parts
says:I think the first requirement should also add “The first
length
elements starting fromptr
are initialized”. And the second requirement could be relaxed into “capacity
needs to be less than or equal to the capacity that the pointer was allocated with”, this is becauseAllocator::deallocate
does not require specifying exact size that the pointer was allocated with.The text was updated successfully, but these errors were encountered: